-
Notifications
You must be signed in to change notification settings - Fork 565
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
fixes xenos seeing raw html on paper #4654
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit picks
Co-authored-by: harryob <[email protected]>
Co-authored-by: harryob <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things: HTML attribute handling and replacetext issues
if(message[character_index] == ">") | ||
parsing_message = TRUE | ||
continue | ||
if(message[character_index] == "<") | ||
parsing_message = FALSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to check for quotation marks inside of HTML tags. Consider a tag such as <tag property=">Injection()" />
. So when you are inside an HTML tag and run into a quotation mark (either single '
or double "
), then you advance until you find the matching quotation mark. Perhaps you could add a couple booleans for this, e.g. need_single_quote
and need_double_quote
.
Maybe it would be a bit overkill but it's probably good to be safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright.
current_string_to_scramble += message[character_index] | ||
|
||
for(var/unscrambled_message_key in replaced_scrambled_strings) | ||
message = replacetext(message, unscrambled_message_key, replaced_scrambled_strings[unscrambled_message_key]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Carefully-crafted user input would make this replace text inside of HTML tags. This should be reworked to be a bit more similar to how /proc/stars
works, where the final message is being appended to in the original for
loop. In this case, you could be appending scrambled_string
from the loop before to a variable representing the final output. I suspect that would also be better performance-wise compared to repeatedly searching through the whole text for replacements.
Your current code also means that duplicates of unscrambled_message_key
would get the same star text, while doing it iteratively would preserve the original behavior of not duplicating star text instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make it iterative.
going to be busy, i'm closing this pr for now. I'll get to it later. |
branch being real funky, closing and making a new branch. |
# About the pull request Continuation of #4654 , to fix #4609 . This fix should make it so that when xenos examine paper it no longer displays a blank page and the raw html was replaced with the formatted scrambled message. # Explain why it's good for the game raw html is rather ugly https://github.com/cmss13-devs/cmss13/assets/122310258/c279d8c8-e81e-477f-bcd0-cadc2bd32b4e # Changelog :cl: fix: fixes xenos being able to view raw html on paper. /:cl: --------- Co-authored-by: harryob <[email protected]> Co-authored-by: Drathek <[email protected]>
About the pull request
currently work in progress, fixes the bug as outlined here #4609
Explain why it's good for the game
bug bad
Testing Photographs and Procedure
xeno_paper_bug.mp4
Changelog
🆑
fix: xenos viewing paper no longer displays unformatted raw HTML
/:cl: