We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7e77fb3 + f9d8834 commit ea24d2dCopy full SHA for ea24d2d
src/fetch_response.js
@@ -81,8 +81,10 @@ export class FetchResponse {
81
if (this.isScript) {
82
const script = document.createElement('script')
83
const metaTag = document.querySelector('meta[name=csp-nonce]')
84
- const nonce = metaTag && metaTag.content
85
- if (nonce) { script.setAttribute('nonce', nonce) }
+ if (metaTag) {
+ const nonce = metaTag.nonce === '' ? metaTag.content : metaTag.nonce
86
+ if (nonce) { script.setAttribute('nonce', nonce) }
87
+ }
88
script.innerHTML = await this.text
89
document.body.appendChild(script)
90
} else {
0 commit comments