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 escape double quote in msgid issue #12

Merged
merged 1 commit into from
Jul 18, 2023
Merged

Conversation

chaomao
Copy link
Contributor

@chaomao chaomao commented Jul 16, 2023

Behavior

If msgid contains double quote, method push_buffer will escape it then parsing. which mismatch the original msgid

let's say we have following msgid contains double quote, say "Hello"

msgid "contains double quote, say \"Hello\""
msgstr "contains double quote, say \"Hello\""

after parsing, content will be

{"contains double quote, say \\\"Hello\\\""=>["contains double quote, say \\\"Hello\\\""]}

the msgid are wrong contains double quote, say \"Hello\"

Analyze

in method push_buffer, value.gsub!(/\\"/, "\"") will trying to fix it, however method gsub will NOT modify the original string object, we should use gsub! instead.

in method push_buffer, gsub will NOT modify the original string object, use gsub! instead
@tboerger
Copy link
Member

Good catch, thanks. Since this is potentially a breaking change I think it makes sense to release a mjor version for that.

@tboerger tboerger merged commit eec5b1d into webhippie:master Jul 18, 2023
51 checks passed
@chaomao
Copy link
Contributor Author

chaomao commented Jul 19, 2023

thanks :)

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

2 participants