Skip to content

Commit bcd4316

Browse files
authored
fix(core): properly add CSP header to fallback routes (#3641)
1 parent f5efc24 commit bcd4316

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changes/fix-csp-fallback-route.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Properly apply the CSP when loading a route that fallbacks to index.html.

core/tauri/src/manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,6 @@ impl<R: Runtime> WindowManager<R> {
733733
// skip leading `/`
734734
path.chars().skip(1).collect::<String>()
735735
};
736-
let is_html = path.ends_with(".html");
737736

738737
let mut asset_path = AssetKey::from(path.as_str());
739738

@@ -757,6 +756,7 @@ impl<R: Runtime> WindowManager<R> {
757756
.map(Cow::into_owned);
758757

759758
let mut csp_header = None;
759+
let is_html = asset_path.as_ref().ends_with(".html");
760760

761761
match asset_response {
762762
Ok(asset) => {

0 commit comments

Comments
 (0)