Unverified Commit 0751ba2c authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub
Browse files

Merge pull request #41 from xTibor/fix-unicode

file_manager: Fix panic on Unicode filenames
parents 9eb95466 4bc2caee
......@@ -129,8 +129,7 @@ impl FileType {
if file_name.ends_with('/') {
Self::new("folder".to_owned(), "inode-directory")
} else {
let pos = file_name.rfind('.').unwrap_or(0) + 1;
let ext = &file_name[pos..];
let ext = file_name.rsplitn(2, '.').next().unwrap_or("");
let mime = mime_guess::get_mime_type(ext);
let image = match (&mime.0, &mime.1) {
(&MimeTop::Image, _) => "image-x-generic",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment