Fixed multilingualism breaking ' and " in chat, and prevent html

injection
This commit is contained in:
ShadowLarkens
2020-04-24 16:10:31 -07:00
parent 66ab143d31
commit 6d59dbdfef
3 changed files with 15 additions and 4 deletions

View File

@@ -172,6 +172,11 @@ proc/get_radio_key_from_channel(var/channel)
//Clean up any remaining space on the left //Clean up any remaining space on the left
message = trim_left(message) 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 //Parse the language code and consume it
var/list/message_pieces = parse_languages(message) var/list/message_pieces = parse_languages(message)
if(istype(message_pieces, /datum/multilingual_say_piece)) // Little quark for dealing with hivemind/signlang languages. if(istype(message_pieces, /datum/multilingual_say_piece)) // Little quark for dealing with hivemind/signlang languages.

View File

@@ -12,7 +12,6 @@
set category = "IC" set category = "IC"
set_typing_indicator(FALSE) set_typing_indicator(FALSE)
message = sanitize_or_reflect(message, src) //VOREStation Edit - Reflect too-long messages, within reason
usr.say(message) usr.say(message)
/mob/verb/me_verb(message as text) /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. // 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] var/datum/language/L = current[1]
if(L && (L.flags & HIVEMIND || L.flags & SIGNLANG)) 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 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) . += new /datum/multilingual_say_piece(current[1], spoke_message)
else else
var/next = prefix_locations[i + 1] // We look ahead at the next message to see where we need to stop. 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) . += 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 */ /* These are here purely because it would be hell to try to convert everything over to using the multi-lingual system at once */

View File

@@ -84,6 +84,13 @@
else else
return message 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) /proc/fail_to_chat(user,message)
if(!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>") 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>")