From cae642b024b798d3dc5a862649d26f3981a62209 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 31 Oct 2025 13:54:27 +0100 Subject: [PATCH] fix: send webm as file, it is not supported by all UI --- src/message.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/message.rs b/src/message.rs index 98f17d820..46d5ff675 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1440,7 +1440,15 @@ pub(crate) fn guess_msgtype_from_path_suffix(path: &Path) -> Option<(Viewtype, & let extension: &str = &path.extension()?.to_str()?.to_lowercase(); let info = match extension { // before using viewtype other than Viewtype::File, - // make sure, all target UIs support that type in the context of the used viewer/player. + // make sure, all target UIs support that type. + // + // it is a non-goal to support as many formats as possible in-app. + // additional parser come at security and maintainance costs and + // should only be added when strictly neccessary, + // eg. when a format comes from the camera app on a significant number of devices. + // it is okay, when eg. dragging some video from a browser results in a "File" + // for everyone, sender as well as all receivers. + // // if in doubt, it is better to default to Viewtype::File that passes handing to an external app. // (cmp. ) "3gp" => (Viewtype::Video, "video/3gpp"), @@ -1503,7 +1511,7 @@ pub(crate) fn guess_msgtype_from_path_suffix(path: &Path) -> Option<(Viewtype, & "vcf" => (Viewtype::Vcard, "text/vcard"), "wav" => (Viewtype::Audio, "audio/wav"), "weba" => (Viewtype::File, "audio/webm"), - "webm" => (Viewtype::Video, "video/webm"), + "webm" => (Viewtype::File, "video/webm"), // not supported natively by iOS nor by SDWebImage "webp" => (Viewtype::Image, "image/webp"), // iOS via SDWebImage, Android since 4.0 "wmv" => (Viewtype::Video, "video/x-ms-wmv"), "xdc" => (Viewtype::Webxdc, "application/webxdc+zip"),