Skip to content

Commit 15589b0

Browse files
committed
fix(webview-ui): stripCData removes raw and HTML-encoded CDATA markers without no-op replacements (resolves CodeQL warning)
1 parent 5f17d50 commit 15589b0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

webview-ui/src/utils/diffUtils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ function isSearchReplace(s: string): boolean {
5555
function stripCData(s: string): string {
5656
return (
5757
s
58-
// HTML-encoded CDATA open -> raw, then strip raw
59-
.replace(/<!\[CDATA\[/g, "<![CDATA[")
58+
// Remove HTML-encoded and raw CDATA open
59+
.replace(/<!\[CDATA\[/gi, "")
6060
.replace(/<!\[CDATA\[/g, "")
61-
// HTML-encoded CDATA close -> raw, then strip raw
62-
.replace(/\]\]>/g, "]]>")
61+
// Remove HTML-encoded and raw CDATA close
62+
.replace(/\]\]>/gi, "")
6363
.replace(/\]\]>/g, "")
6464
)
6565
}

0 commit comments

Comments
 (0)