mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
fix: skip empty script tag for CSP hash properly (#14274)
* fix: skip empty script tag for CSP hash properly * add change file --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
5
.changes/fix-csp-empty-selector.md
Normal file
5
.changes/fix-csp-empty-selector.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-codegen": patch:bug
|
||||
---
|
||||
|
||||
Do not hash empty scripts when generating the Content-Security-Policy SHA-256 hashes.
|
||||
@@ -45,7 +45,7 @@ pub struct ContextData {
|
||||
}
|
||||
|
||||
fn inject_script_hashes(document: &NodeRef, key: &AssetKey, csp_hashes: &mut CspHashes) {
|
||||
if let Ok(inline_script_elements) = document.select("script:not(empty)") {
|
||||
if let Ok(inline_script_elements) = document.select("script:not(:empty)") {
|
||||
let mut scripts = Vec::new();
|
||||
for inline_script_el in inline_script_elements {
|
||||
let script = inline_script_el.as_node().text_contents();
|
||||
|
||||
Reference in New Issue
Block a user