Skip to content

Commit

Permalink
fix: Attempt turbo csp nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
jsip committed Dec 7, 2023
1 parent d6d3850 commit 974037a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ export function nextMicrotask() {
}

export function parseHTMLDocument(html = "") {
return new DOMParser().parseFromString(html, "text/html")
let parsedHTML: Document = new DOMParser().parseFromString(html, "text/html")

Check failure on line 70 in src/util.ts

View workflow job for this annotation

GitHub Actions / build

'parsedHTML' is never reassigned. Use 'const' instead
parsedHTML.querySelectorAll("style").forEach((element: HTMLElement) => {
const cspNonce = (document.head.querySelector('meta[property=csp-nonce]') as HTMLMetaElement)?.content || ''

Check failure on line 72 in src/util.ts

View workflow job for this annotation

GitHub Actions / build

Replace `'meta[property=csp-nonce]')·as·HTMLMetaElement)?.content·||·''` with `"meta[property=csp-nonce]")·as·HTMLMetaElement)?.content·||·""`
element.nonce = cspNonce
})
return parsedHTML
}

export function unindent(strings: TemplateStringsArray, ...values: any[]): string {
Expand Down

0 comments on commit 974037a

Please sign in to comment.