blob: 6fc0f9fbff705336a3b488639087818c1e772566 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use std::ffi::OsStr;
pub fn default_mime_type() -> &'static str {
"application/octet-stream"
}
pub fn get_mime_type(extension: &OsStr) -> &'static str {
let ext_str = match extension.to_str() {
Some(ext_str) => ext_str,
None => {
return default_mime_type();
}
};
match ext_str {
"gmi" => "text/gemini",
"txt" => "text/plain",
_ => default_mime_type(),
}
}
|