Fixes: Webp images using image_proxy can't be saved in Android 10+#1801
Conversation
|
I don't really like this solution as now it prevents inferring MIME type which was used to set file exentension when saving. Instead just saves the webp as jpeg. For imageviewers it doesn't rlly matter as they read content anyway. I'll check when i have some time if there is anything wrong with webp image. But I don't see another solution. |
dessalines
left a comment
There was a problem hiding this comment.
Not much we can do about that, its a pictrs proxy issue.
|
FWIW, as a non-dev user of this app, this problem makes the app nigh-unusable from my userland perspective, and it's been going on for "a while now" if i can't use the 'share' button to export a funny picture of a running owl to whatsapp.... then what's the point at looking for fresh memes Obviously this is an unserious complaint, but also, ya know genuine and sorta serious. FWIW i don't think it is sending the webp image just without an extension or mime type, unless every webp is automagacially to be listed as 45kB size. Or maybe that's some standard thumnail size. IDK. Thanks to everyone competent (not me) who works on software like this, and my input is meant purely to be informative and not haranguing. |
|
This change doesn't change anything for share action. As that works somewhat, depends on how the app handles the received extensionless image file. Ideally we would support the image_proxy endpoint better to extract necessary information that is needed. (image name + extension) It just fixes the download action from failing when trying to save extenionless webp images as it seems to be wrongly inferring the MIME type for it. It shouldn't be downloading/sharing the wrong image. So if you see that behaviour, could post a separate issue with a reproducer. |
Well, from a user perspective, it just doesn't work at all in any way that ins't prohibitively fussy. The options to share your funny image successfully are to [screenshot, crop, save and share] or [download, locate, rename, save and share] Neither of which are worth it for most cat pics. My expectation is that most casual users would fix this by downloading a different app that 'just works' Don't take that as a criticism of the app or your (Everyone's) efforts. It's just going to be a typical user response to a frustration with some commonly-expected function that doesn't work. From my userland experience with Jeroba, this is something that used to work seamlessly, and now is broken. |
That's the best option, because that isn't going anywhere, and should be stable. You should be able to assume the mime type from the existing extension. |
|
Alright I look into it |
Worked on API Level 28 and below, uses a different API.
It fails to read MIME type from url. Normally thats fine, it will infer later when it gets inserted. For most images that okay, but it seems for webp images (or atleast those from pictrs) it infers the mime as "application/octet-stream" and then it throws exception because
Images.Media.EXTERNAL_CONTENT_URIdoesn't allow that MIME to be inserted there.I looked at what some other clients do, some dont set MIME at all, meaning those images would also fail. Some always set
image/jpeg. I added fallback for that here.Not sure what the future holds for image_proxy endpoint? If kept we might want to better support it, properly extract extension and filename from it.
Fixes #1800
allDevices was fix for deprecation (just rename)
This whole file handling is quite messy in Android. Basically forced to give wrong MIME.