-
-
Notifications
You must be signed in to change notification settings - Fork 104
fix: Treat and send images that can't be decoded as Viewtype::File #6904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7d529fe
to
ea615da
Compare
98baeb7
to
5ba3d29
Compare
Tested in Desktop. Note that if an image is sent as |
5ba3d29
to
4917336
Compare
Now i think this isn't a correct behavior. If smth can't be sent as image, the metadata isn't removed and a potentially big file is sent. It's better to fail sending. The user should retry to send the "image" as EDIT: I have no idea why we implemented this unsafe sending of the original file. Does anyone know? |
4917336
to
4d2939f
Compare
4d2939f
to
beb52a1
Compare
@@ -500,10 +497,11 @@ impl<'a> BlobObject<'a> { | |||
Ok(_) => res, | |||
Err(err) => { | |||
if !is_avatar && no_exif { | |||
warn!( | |||
error!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error!
messages are displayed as a toast in the UI, do we really want it here? Not being able to decode an image is not an exceptional state, users may drop HEIF images into the UI and we cannot prevent this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, this error is not translated, but i wanted to warn the user that the original data will be sent which may contain sensitive metadata, and the message may be huge.
EDIT: no_exif
is false by default, so metadata isn't a problem. But the original file name would preserve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed another commit, fix: Decide on filename used for sending depending on the original Viewtype
, fixing this problem. Still i'd prefer this to be error!
to warn the user that the message may be huge
`Viewtype::Sticker` has special meaning: the file should be an image having fully transparent pixels. But "tgs" (Telegram animated sticker) is a compressed JSON and isn't recognized by Core as image.
Guessing mimetype is already done in `chat::prepare_msg_blob()`.
Otherwise unsupported and corrupted images are displayed in the "Images" tab in UIs and that looks as a Delta Chat bug. This should be a rare case though, so log it as error and let the user know that metadata isn't removed from the image at least.
…ewtype If a user attaches an image as `File`, we should send the original filename. And vice versa, if it's `Image` originally, we mustn't reveal the filename. The filename used for sending is now also saved to the db, so all the sender's devices will display the same filename in the message info.
We don't want images having unsupported format or corrupted ones to be sent as `Image` and appear in the "Images" tab in UIs because they can't be displayed correctly.
beb52a1
to
0b6154c
Compare
See commit messages and also deltachat/deltachat-desktop#3879 for reasoning.