Skip to content

Commit

Permalink
fix(backend): fix github svg not showing up
Browse files Browse the repository at this point in the history
Change mime type to `image/svg+xml`
  • Loading branch information
ravenclaw900 committed Apr 2, 2022
1 parent 96c4197 commit 169467d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ fn main() {
let assets_route = warp::path("assets")
.and(warp::path::param())
.map(|path: String| {
let ext = path.rsplit('.').next().unwrap();
warp::reply::with_header(
DIR.get_file(format!("assets/{}", path)).unwrap().contents(),
"content-type",
format!(
"text/{}",
if path.rsplit('.').next().unwrap() == "js" {
"javascript"
} else {
path.rsplit('.').next().unwrap()
}
),
if ext == "js" {
"text/javascript".to_string()
} else if ext == "svg" {
"image/svg+xml".to_string()
} else {
format!("text/{}", ext)
},
)
});

Expand Down

0 comments on commit 169467d

Please sign in to comment.