Lowercase extension before detemining media type (#437)

This commit is contained in:
fdb-hiroshima 2019-01-27 13:44:09 +01:00 committed by Igor Galić
parent e77e4d86e8
commit 716c58cb71
1 changed files with 2 additions and 1 deletions

View File

@ -57,11 +57,12 @@ impl Media {
} }
pub fn category(&self) -> MediaCategory { pub fn category(&self) -> MediaCategory {
match self match &*self
.file_path .file_path
.rsplitn(2, '.') .rsplitn(2, '.')
.next() .next()
.expect("Media::category: extension error") .expect("Media::category: extension error")
.to_lowercase()
{ {
"png" | "jpg" | "jpeg" | "gif" | "svg" => MediaCategory::Image, "png" | "jpg" | "jpeg" | "gif" | "svg" => MediaCategory::Image,
"mp3" | "wav" | "flac" => MediaCategory::Audio, "mp3" | "wav" | "flac" => MediaCategory::Audio,