From 716c58cb715b03e734a8c58c23ea5321a573eb6c Mon Sep 17 00:00:00 2001 From: fdb-hiroshima <35889323+fdb-hiroshima@users.noreply.github.com> Date: Sun, 27 Jan 2019 13:44:09 +0100 Subject: [PATCH] Lowercase extension before detemining media type (#437) --- plume-models/src/medias.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plume-models/src/medias.rs b/plume-models/src/medias.rs index 9ec2e743..d55b9e33 100644 --- a/plume-models/src/medias.rs +++ b/plume-models/src/medias.rs @@ -57,11 +57,12 @@ impl Media { } pub fn category(&self) -> MediaCategory { - match self + match &*self .file_path .rsplitn(2, '.') .next() .expect("Media::category: extension error") + .to_lowercase() { "png" | "jpg" | "jpeg" | "gif" | "svg" => MediaCategory::Image, "mp3" | "wav" | "flac" => MediaCategory::Audio,