If there's no extension or unknown file type it will send text/plain

This commit is contained in:
int 80h
2020-05-28 17:28:00 -04:00
parent 014b7c938b
commit 44f37e139b

View File

@@ -27,9 +27,12 @@ mod tls;
fn get_mime(path: &PathBuf) -> String { fn get_mime(path: &PathBuf) -> String {
let mut mime = "text/gemini".to_string(); let mut mime = "text/gemini".to_string();
if path.is_dir() {
return mime;
}
let ext = match path.extension() { let ext = match path.extension() {
Some(p) => p.to_str().unwrap(), Some(p) => p.to_str().unwrap(),
None => return mime, None => return "text/plain".to_string(),
}; };
mime = match ext { mime = match ext {