Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some double-encodes in plexora/tgs stuff #4537

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions code/__HELPERS/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@


/// Runs byond's html encoding sanitization proc, after replacing new-lines and tabs for the # character.
/proc/sanitize(text)
/proc/sanitize(text, encode = TRUE)
var/static/regex/regex = regex(@"[\n\t]", "g")
return html_encode(regex.Replace(text, "#"))
. = replacetext(text, regex, "#")
if(encode)
return html_encode(.)


/// Runs STRIP_HTML_SIMPLE and sanitize.
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/verbs/adminhelp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
else
SSplexora.aticket_new(src, msg_raw, is_bwoink, urgent) // monkestation edit: PLEXORA
MessageNoRecipient(msg_raw, urgent)
send_message_to_tgs(msg, urgent)
send_message_to_tgs(html_decode(msg), urgent)
GLOB.ahelp_tickets.active_tickets += src

/datum/admin_help/proc/format_embed_discord(message)
Expand Down Expand Up @@ -798,7 +798,7 @@ GLOBAL_DATUM_INIT(admin_help_ui_handler, /datum/admin_help_ui_handler, new)
if(user_client.current_ticket)
user_client.current_ticket.TimeoutVerb()
if(urgent)
var/sanitized_message = sanitize(copytext_char(message, 1, MAX_MESSAGE_LEN))
var/sanitized_message = sanitize(trim(message, MAX_MESSAGE_LEN), encode = FALSE)
user_client.current_ticket.send_message_to_tgs(sanitized_message, urgent = TRUE)
user_client.current_ticket.MessageNoRecipient(message, urgent)
return
Expand Down
2 changes: 1 addition & 1 deletion monkestation/code/modules/mentor/mentor_pm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
html = "<font color='green'>Mentor PM to-<b>[key_name_mentor(chosen_client, chosen_client, TRUE, FALSE)]</b>: <span class='message linkify'>[msg]</span></font>",
confidential = TRUE)
var/datum/request/request = GLOB.mentor_requests.requests[chosen_client.ckey][length(GLOB.mentor_requests.requests[chosen_client.ckey])]
SSplexora.mticket_pm(request, src.mob, chosen_client.mob, msg)
SSplexora.mticket_pm(request, src.mob, chosen_client.mob, html_decode(msg))



Expand Down
Loading