diff --git a/fractal-gtk/src/appop/message.rs b/fractal-gtk/src/appop/message.rs index 95f2ff18..b0f11898 100644 --- a/fractal-gtk/src/appop/message.rs +++ b/fractal-gtk/src/appop/message.rs @@ -276,6 +276,7 @@ impl AppOp { let info = match mtype { "m.image" => get_image_media_info(path_string, mime.as_ref()), "m.audio" => get_audio_media_info(path_string, mime.as_ref()), + "m.file" => get_file_media_info(path_string, mime.as_ref()), _ => None, }; @@ -540,3 +541,16 @@ fn get_audio_media_info(file: &str, mimetype: &str) -> Option { Some(info) } + +fn get_file_media_info(file: &str, mimetype: &str) -> Option { + let size = fs::metadata(file).ok()?.len(); + + let info = json!({ + "info": { + "size": size, + "mimetype": mimetype, + } + }); + + Some(info) +}