From 44608a017a5cc43df5f56a1e69593d09ae4fe845 Mon Sep 17 00:00:00 2001 From: Simon Repp Date: Sat, 16 Mar 2024 11:48:39 +0100 Subject: [PATCH] Check/support numerous extensions when uploading video --- src/editor/endpoints/video.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/editor/endpoints/video.rs b/src/editor/endpoints/video.rs index 22bec3a..12de982 100644 --- a/src/editor/endpoints/video.rs +++ b/src/editor/endpoints/video.rs @@ -46,6 +46,7 @@ use crate::util::{ human_size, nanoid, supported_image_extension, + supported_video_extension, validate_slug }; @@ -607,8 +608,9 @@ pub async fn upload_video( let content_disposition = field.content_disposition(); if let Some(filename) = content_disposition.get_filename() { - // TODO: Support all the formats plz, also audio (?!) - if filename.ends_with(".mp4") { + // TODO: Support audio formats as well? + // Or should this be a separate endpoint/feature? + if supported_video_extension(filename) { let original_filename = filename.to_string(); let storage_path = match &container {