Skip to content
This repository was archived by the owner on Feb 7, 2022. It is now read-only.

Commit 0157854

Browse files
author
Aziz Yuldoshev
committed
Escape whitespace in key values
1 parent 051abe1 commit 0157854

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/leaf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ function items(count) {
212212

213213
function getLeafKey(key, value) {
214214
if (isPrimitive(value)) {
215-
return key + ':' + value;
215+
// TODO: Sanitize `value` better.
216+
return key + ':' + String(value).replace(/\s+/g, '_');
216217
} else {
217218
return key + '[' + type(value) + ']';
218219
}

0 commit comments

Comments
 (0)