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(common): escape replaced value #770

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

blastZ
Copy link

@blastZ blastZ commented Jul 2, 2020

Something like this log('I like %O', { name: '%sugar%' }); will cause output incorrect.

Something like this `log('I like %O', { name: '%sugar%' });` will cause output incorrect.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 87.739% when pulling d687542 on blastZ:patch-1 into 80ef62a on visionmedia:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 87.739% when pulling d687542 on blastZ:patch-1 into 80ef62a on visionmedia:master.

@Qix-
Copy link
Member

Qix- commented Jul 2, 2020

Can you add tests for this, please? I'm not sure which sorts of things this fixes.

@blastZ
Copy link
Author

blastZ commented Jul 7, 2020

Can you add tests for this, please? I'm not sure which sorts of things this fixes.

The default formatters will replace %o and %O, so when arguments go to the log function, util.format will get arguments like this ["...'%sugar%'... }", '...']. So if you don't escape the % in the value, util.format will replace %s with the next argument. That's why issue #766 happend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants