Skip to content

Commit 2b108f1

Browse files
committed
fix: send webm as file, it is not supported by all UI
1 parent 8b4c718 commit 2b108f1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/message.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,15 @@ pub(crate) fn guess_msgtype_from_path_suffix(path: &Path) -> Option<(Viewtype, &
14441444
let extension: &str = &path.extension()?.to_str()?.to_lowercase();
14451445
let info = match extension {
14461446
// before using viewtype other than Viewtype::File,
1447-
// make sure, all target UIs support that type in the context of the used viewer/player.
1447+
// make sure, all target UIs support that type.
1448+
//
1449+
// it is a non-goal to support as many formats as possible in-app.
1450+
// additional parser come at security and maintainance costs and
1451+
// should only be added when strictly neccessary,
1452+
// eg. when a format comes from the camera app on a significant number of devices.
1453+
// it is okay, when eg. dragging some video from a browser results in a "File"
1454+
// for everyone, sender as well as all receivers.
1455+
//
14481456
// if in doubt, it is better to default to Viewtype::File that passes handing to an external app.
14491457
// (cmp. <https://developer.android.com/guide/topics/media/media-formats>)
14501458
"3gp" => (Viewtype::Video, "video/3gpp"),
@@ -1507,7 +1515,7 @@ pub(crate) fn guess_msgtype_from_path_suffix(path: &Path) -> Option<(Viewtype, &
15071515
"vcf" => (Viewtype::Vcard, "text/vcard"),
15081516
"wav" => (Viewtype::Audio, "audio/wav"),
15091517
"weba" => (Viewtype::File, "audio/webm"),
1510-
"webm" => (Viewtype::Video, "video/webm"),
1518+
"webm" => (Viewtype::File, "video/webm"), // not supported natively by iOS nor by SDWebImage
15111519
"webp" => (Viewtype::Image, "image/webp"), // iOS via SDWebImage, Android since 4.0
15121520
"wmv" => (Viewtype::Video, "video/x-ms-wmv"),
15131521
"xdc" => (Viewtype::Webxdc, "application/webxdc+zip"),

0 commit comments

Comments
 (0)