diff --git a/.changes/fix-csp-fallback-route.md b/.changes/fix-csp-fallback-route.md new file mode 100644 index 000000000..9003863d5 --- /dev/null +++ b/.changes/fix-csp-fallback-route.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Properly apply the CSP when loading a route that fallbacks to index.html. diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 172dcc50c..53374e3d3 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -733,7 +733,6 @@ impl WindowManager { // skip leading `/` path.chars().skip(1).collect::() }; - let is_html = path.ends_with(".html"); let mut asset_path = AssetKey::from(path.as_str()); @@ -757,6 +756,7 @@ impl WindowManager { .map(Cow::into_owned); let mut csp_header = None; + let is_html = asset_path.as_ref().ends_with(".html"); match asset_response { Ok(asset) => {