Skip to content

Commit e330ef4

Browse files
committed
Convert mime type for javascripts as well
1 parent 0e00e20 commit e330ef4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/db/file.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,15 @@ pub fn add_path_into_database<P: AsRef<Path>>(conn: &Connection,
9292
// css's are causing some problem in browsers
9393
// magic will return text/plain for css file types
9494
// convert them to text/css
95-
if mime == "text/plain" && file_path_str.ends_with(".css") {
96-
"text/css".to_owned()
95+
// do the same for javascript files
96+
if mime == "text/plain" {
97+
if file_path_str.ends_with(".css") {
98+
"text/css".to_owned()
99+
} else if file_path_str.ends_with(".js") {
100+
"application/javascript".to_owned()
101+
} else {
102+
mime.to_owned()
103+
}
97104
} else {
98105
mime.to_owned()
99106
}

0 commit comments

Comments
 (0)