Skip to content

Commit

Permalink
Merge pull request #1151 from tvongaza/use-nonce-and-content-attribut…
Browse files Browse the repository at this point in the history
…e-for-csp

Read the csp meta tag nonce attribute and fall back to content
  • Loading branch information
jorgemanrubia authored Oct 10, 2024
2 parents c85546a + eb1539c commit b2cefb4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/trix/core/helpers/custom_elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const insertStyleElementForTagName = function(tagName) {
const getCSPNonce = function() {
const element = getMetaElement("trix-csp-nonce") || getMetaElement("csp-nonce")
if (element) {
return element.getAttribute("content")
const { nonce, content } = element
return nonce == "" ? content : nonce
}
}

Expand Down

0 comments on commit b2cefb4

Please sign in to comment.