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: parse irc tags with consecutive escapes #3711

Merged
merged 3 commits into from
May 7, 2022

Conversation

iProdigy
Copy link
Contributor

@iProdigy iProdigy commented May 6, 2022

Pull request checklist:

  • CHANGELOG.md was updated, if applicable

Description

When an irc tag has multiple escaped characters in a row, the current parseTagString function fails to see the 2nd \ due to the extra i++ (since the loop declaration already has i++ and the string replacement eats two characters)

Example: system-msg=DefectiveCloak\s\sgifted\sa\sTier\s1\ssub\sto\saliiscrying! (weird case where their display name has a trailing space)

image

@Felanbird
Copy link
Collaborator

@badges=subscriber/0,premium/1;color=#1E90FF;display-name=ItsVinc\s;emotes=80481:0-4;id=376529fd-31a8-4da9-9c0d-92a9470da2cd;login=itsvinc;mod=0;msg-id=resub;msg-param-months=2;msg-param-sub-plan-name=Dakotaz;msg-param-sub-plan=1000;room-id=11148817;subscriber=1;system-msg=ItsVinc\s\sjust\ssubscribed\swith\sa\sTier\s1\ssub.\sItsVinc\s\ssubscribed\sfor\s2\smonths\sin\sa\srow!;tmi-sent-ts=1528191154801;turbo=0;user-id=41174867;user-type= :tmi.twitch.tv USERNOTICE #pajlada :pajaW

before change:
image

after change:
image

Took an existing debug resub message and inserted a user with a trailing space, seems the literal \s is replaced with a literal space, which while annoying to see, is likely better than seeing a literal \s.

(or maybe I made a mistake in this rawMSG and this change works exactly as intended, tune in to find out).

@iProdigy
Copy link
Contributor Author

iProdigy commented May 6, 2022

yeah this PR doesn't add any trimming between words, just makes sure to convert all \s to spaces

Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some tests and then reverted your fix, and saw the wrong behaviour you described 👍 Thanks for the fix!

@pajlada pajlada enabled auto-merge (squash) May 7, 2022 13:41
@pajlada pajlada merged commit b2ed4c0 into Chatterino:master May 7, 2022
@iProdigy iProdigy deleted the fix/irc-tag-escaped branch May 7, 2022 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants