fix: Don't remove file extension when recoding avatars

There was a bug that file extensions were removed when recoding an
avatar. The problem was that `recode_avatar` used `name` to check for
the extension, but some functions passed an empty string.
There even were two tests from before the decision to keep the
extensions that tested for the faulty behavior.
This commit is contained in:
Hocuri
2025-01-24 21:31:48 +01:00
parent 60f8b68690
commit 28e3fbfebb
2 changed files with 11 additions and 29 deletions

View File

@@ -2782,11 +2782,7 @@ async fn prepare_msg_blob(context: &Context, msg: &mut Message) -> Result<()> {
|| maybe_sticker && !msg.param.exists(Param::ForceSticker))
{
let new_name = blob
.recode_to_image_size(
context,
msg.get_filename().unwrap_or_else(|| "file".to_string()),
&mut maybe_sticker,
)
.recode_to_image_size(context, msg.get_filename(), &mut maybe_sticker)
.await?;
msg.param.set(Param::Filename, new_name);