@@ -126,13 +126,7 @@ fn set_csp<R: Runtime>(
126126 default_src. push ( format_real_schema ( schema) ) ;
127127 }
128128
129- #[ allow( clippy:: let_and_return) ]
130- let csp = Csp :: DirectiveMap ( csp) . to_string ( ) ;
131- #[ cfg( target_os = "linux" ) ]
132- {
133- * asset = set_html_csp ( asset, & csp) ;
134- }
135- csp
129+ Csp :: DirectiveMap ( csp) . to_string ( )
136130}
137131
138132#[ cfg( target_os = "linux" ) ]
@@ -826,13 +820,16 @@ impl<R: Runtime> WindowManager<R> {
826820
827821 // if it's an HTML file, we need to set the CSP meta tag on Linux
828822 #[ cfg( target_os = "linux" ) ]
829- if let ( Some ( original_csp) , Some ( response_csp) ) = (
830- asset. csp_header ,
831- response. headers ( ) . get ( "Content-Security_Policy" ) ,
832- ) {
823+ if let Some ( response_csp) = response. headers ( ) . get ( "Content-Security-Policy" ) {
833824 let response_csp = String :: from_utf8_lossy ( response_csp. as_bytes ( ) ) ;
834- if response_csp != original_csp {
835- let body = set_html_csp ( & String :: from_utf8_lossy ( response. body ( ) ) , & response_csp) ;
825+ let body = set_html_csp ( & String :: from_utf8_lossy ( response. body ( ) ) , & response_csp) ;
826+ * response. body_mut ( ) = body. as_bytes ( ) . to_vec ( ) ;
827+ }
828+ } else {
829+ #[ cfg( target_os = "linux" ) ]
830+ {
831+ if let Some ( csp) = & asset. csp_header {
832+ let body = set_html_csp ( & String :: from_utf8_lossy ( response. body ( ) ) , csp) ;
836833 * response. body_mut ( ) = body. as_bytes ( ) . to_vec ( ) ;
837834 }
838835 }
0 commit comments