mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Fixed multilingualism breaking ' and " in chat, and prevent html
injection
This commit is contained in:
@@ -172,6 +172,11 @@ proc/get_radio_key_from_channel(var/channel)
|
||||
//Clean up any remaining space on the left
|
||||
message = trim_left(message)
|
||||
|
||||
// VOREStation Edit - Reflect messages as needed, no sanitizing because parse_languages will handle it for us
|
||||
if(reflect_if_needed(message, src))
|
||||
return
|
||||
// VOREStation Edit End
|
||||
|
||||
//Parse the language code and consume it
|
||||
var/list/message_pieces = parse_languages(message)
|
||||
if(istype(message_pieces, /datum/multilingual_say_piece)) // Little quark for dealing with hivemind/signlang languages.
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
set category = "IC"
|
||||
|
||||
set_typing_indicator(FALSE)
|
||||
message = sanitize_or_reflect(message, src) //VOREStation Edit - Reflect too-long messages, within reason
|
||||
usr.say(message)
|
||||
|
||||
/mob/verb/me_verb(message as text)
|
||||
@@ -216,14 +215,14 @@
|
||||
// There are a few things that will make us want to ignore all other languages in - namely, HIVEMIND languages.
|
||||
var/datum/language/L = current[1]
|
||||
if(L && (L.flags & HIVEMIND || L.flags & SIGNLANG))
|
||||
return new /datum/multilingual_say_piece(L, trim(strip_prefixes(message)))
|
||||
return new /datum/multilingual_say_piece(L, trim(sanitize(strip_prefixes(message))))
|
||||
|
||||
if(i + 1 > length(prefix_locations)) // We are out of lookaheads, that means the rest of the message is in cur lang
|
||||
var/spoke_message = handle_autohiss(trim(copytext(message, current[3])), L)
|
||||
var/spoke_message = sanitize(handle_autohiss(trim(copytext(message, current[3])), L))
|
||||
. += new /datum/multilingual_say_piece(current[1], spoke_message)
|
||||
else
|
||||
var/next = prefix_locations[i + 1] // We look ahead at the next message to see where we need to stop.
|
||||
var/spoke_message = handle_autohiss(trim(copytext(message, current[3], next[2])), L)
|
||||
var/spoke_message = sanitize(handle_autohiss(trim(copytext(message, current[3], next[2])), L))
|
||||
. += new /datum/multilingual_say_piece(current[1], spoke_message)
|
||||
|
||||
/* These are here purely because it would be hell to try to convert everything over to using the multi-lingual system at once */
|
||||
|
||||
@@ -84,6 +84,13 @@
|
||||
else
|
||||
return message
|
||||
|
||||
// returns true if it failed
|
||||
/proc/reflect_if_needed(message, user)
|
||||
if(length(message) > MAX_HUGE_MESSAGE_LEN)
|
||||
fail_to_chat(user)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/proc/fail_to_chat(user,message)
|
||||
if(!message)
|
||||
to_chat(user, "<span class='danger'>Your message was NOT SENT, either because it was FAR too long, or sanitized to nothing at all.</span>")
|
||||
|
||||
Reference in New Issue
Block a user