File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ async fn serve_deployment_file(
198
198
cid : Option < String > ,
199
199
state : & State ,
200
200
) -> Response {
201
- let mime = deployment_file. deployment_file_mime_type . clone ( ) ;
201
+ let mime = polyfill_mime_type ( & deployment_file. deployment_file_mime_type . clone ( ) , & deployment_file . deployment_file_file_path ) ;
202
202
let file_key = deployment_file. file_hash . clone ( ) ;
203
203
// let cid_path = format!("{}/{}", cid.unwrap_or("".to_string()), deployment_file.deployment_file_file_path);
204
204
@@ -293,3 +293,13 @@ async fn serve_deployment_file(
293
293
}
294
294
}
295
295
}
296
+
297
+ fn polyfill_mime_type ( mime : & str , file_name : & str ) -> String {
298
+ let extension = file_name. split ( '.' ) . last ( ) . unwrap_or ( "" ) ;
299
+
300
+ if mime == "text/xml" && extension == "svg" {
301
+ "image/svg+xml" . to_string ( )
302
+ } else {
303
+ mime. to_string ( )
304
+ }
305
+ }
You can’t perform that action at this time.
0 commit comments