debug icon indicating copy to clipboard operation
debug copied to clipboard

fix(common): escape replaced value

Open blastZ opened this issue 4 years ago • 4 comments

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

blastZ avatar Jul 02 '20 14:07 blastZ

Coverage Status

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

coveralls avatar Jul 02 '20 14:07 coveralls

Coverage Status

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

coveralls avatar Jul 02 '20 14:07 coveralls

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

Qix- avatar Jul 02 '20 14:07 Qix-

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.

blastZ avatar Jul 07 '20 11:07 blastZ