Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fixes: Webp images using image_proxy can't be saved in Android 10+#1801

Merged
dessalines merged 3 commits into
LemmyNet:mainfrom
MV-GH:patch-1800
Apr 21, 2025
Merged

Fixes: Webp images using image_proxy can't be saved in Android 10+#1801
dessalines merged 3 commits into
LemmyNet:mainfrom
MV-GH:patch-1800

Conversation

@MV-GH

@MV-GH MV-GH commented Apr 17, 2025

Copy link
Copy Markdown
Collaborator

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_URI doesn'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.

@MV-GH MV-GH requested a review from dessalines as a code owner April 17, 2025 23:40
@MV-GH

MV-GH commented Apr 18, 2025

Copy link
Copy Markdown
Collaborator Author

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 dessalines left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much we can do about that, its a pictrs proxy issue.

@dessalines dessalines merged commit 944707d into LemmyNet:main Apr 21, 2025
@scirocco-github

Copy link
Copy Markdown

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.

@MV-GH

MV-GH commented Apr 30, 2025

Copy link
Copy Markdown
Collaborator Author

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)
But I believe the image_proxy endpoint is on shaky grounds. Unless I am mistaken? So not sure if we should commit to something that could be removed.

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.

@MV-GH MV-GH deleted the patch-1800 branch April 30, 2025 18:21
@scirocco-github

Copy link
Copy Markdown

This change doesn't change anything for share action. As that works somewhat, depends on how the app handles the received extensionless image file.

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.

@dessalines

Copy link
Copy Markdown
Member

Ideally we would support the image_proxy endpoint better to extract necessary information that is needed. (image name + extension)

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.

@MV-GH

MV-GH commented May 1, 2025

Copy link
Copy Markdown
Collaborator Author

Alright I look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't download or share pictures from some links

3 participants