Skip to content

Commit cae642b

Browse files
committed
fix: send webm as file, it is not supported by all UI
1 parent 54a2e94 commit cae642b

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
@@ -1440,7 +1440,15 @@ pub(crate) fn guess_msgtype_from_path_suffix(path: &Path) -> Option<(Viewtype, &
14401440
let extension: &str = &path.extension()?.to_str()?.to_lowercase();
14411441
let info = match extension {
14421442
// before using viewtype other than Viewtype::File,
1443-
// make sure, all target UIs support that type in the context of the used viewer/player.
1443+
// make sure, all target UIs support that type.
1444+
//
1445+
// it is a non-goal to support as many formats as possible in-app.
1446+
// additional parser come at security and maintainance costs and
1447+
// should only be added when strictly neccessary,
1448+
// eg. when a format comes from the camera app on a significant number of devices.
1449+
// it is okay, when eg. dragging some video from a browser results in a "File"
1450+
// for everyone, sender as well as all receivers.
1451+
//
14441452
// if in doubt, it is better to default to Viewtype::File that passes handing to an external app.
14451453
// (cmp. <https://developer.android.com/guide/topics/media/media-formats>)
14461454
"3gp" => (Viewtype::Video, "video/3gpp"),
@@ -1503,7 +1511,7 @@ pub(crate) fn guess_msgtype_from_path_suffix(path: &Path) -> Option<(Viewtype, &
15031511
"vcf" => (Viewtype::Vcard, "text/vcard"),
15041512
"wav" => (Viewtype::Audio, "audio/wav"),
15051513
"weba" => (Viewtype::File, "audio/webm"),
1506-
"webm" => (Viewtype::Video, "video/webm"),
1514+
"webm" => (Viewtype::File, "video/webm"), // not supported natively by iOS nor by SDWebImage
15071515
"webp" => (Viewtype::Image, "image/webp"), // iOS via SDWebImage, Android since 4.0
15081516
"wmv" => (Viewtype::Video, "video/x-ms-wmv"),
15091517
"xdc" => (Viewtype::Webxdc, "application/webxdc+zip"),

0 commit comments

Comments
 (0)