Skip to content

Commit d687542

Browse files
authored
fix(common): escape replaced value
Something like this `log('I like %O', { name: '%sugar%' });` will cause output incorrect.
1 parent 80ef62a commit d687542

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function setup(env) {
9999
if (typeof formatter === 'function') {
100100
const val = args[index];
101101
match = formatter.call(self, val);
102+
match = match.replace(/%/g, () => '%%');
102103

103104
// Now we need to remove `args[index]` since it's inlined in the `format`
104105
args.splice(index, 1);

0 commit comments

Comments
 (0)