Skip to content

Commit 7e47ea5

Browse files
authored
No escaping
1 parent d9d9ba8 commit 7e47ea5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/extensions/jwPointer/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ function span(text) {
1313
return el
1414
}
1515

16+
const escapeHTML = unsafe => {
17+
return unsafe
18+
.replaceAll("&", "&")
19+
.replaceAll("<", "&lt;")
20+
.replaceAll(">", "&gt;")
21+
.replaceAll('"', "&quot;")
22+
.replaceAll("'", "&#039;")
23+
};
24+
1625
const pointerLimit = Number.MAX_SAFE_INTEGER;
1726
let currentPointerID = 0;
1827

@@ -100,7 +109,7 @@ class PointerType {
100109
} else if (this.value instanceof PointerType) {
101110
value = span("(Pointer)")
102111
} else {
103-
value = this.value.toReporterContent ? this.value.toReporterContent() : span(this.value)
112+
value = this.value.toReporterContent ? this.value.toReporterContent() : span(typeof this.value == "string" ? escapeHTML(this.value) : this.value)
104113
}
105114
} catch (e) {
106115
value = span("(Recursive)")

0 commit comments

Comments
 (0)