Lowercase extension before detemining media type (#437)
This commit is contained in:
parent
e77e4d86e8
commit
716c58cb71
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user