Skip to content

Commit c117cf1

Browse files
committed
Use text/css mime type for css files
1 parent 6ec03cb commit c117cf1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/db/file.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,17 @@ pub fn add_path_into_database<P: AsRef<Path>>(conn: &Connection,
8787
};
8888
let mut content: Vec<u8> = Vec::new();
8989
try!(file.read_to_end(&mut content));
90-
let mime = try!(cookie.buffer(&content));
90+
let mime = {
91+
let mime = try!(cookie.buffer(&content));
92+
// css's are causing some problem in browsers
93+
// magic will return text/plain for css file types
94+
// convert them to text/css
95+
if mime == "text/plain" && file_path_str.ends_with(".css") {
96+
"text/css".to_owned()
97+
} else {
98+
mime.to_owned()
99+
}
100+
};
91101

92102
file_list_with_mimes.push((mime.clone(), file_path_str.clone()));
93103

0 commit comments

Comments
 (0)