Images corrupted when proxied #2

Closed
opened 2025-07-06 14:58:09 -07:00 by swee · 1 comment
Owner

This happens on both Gunicorn and Hypercorn, so it isn't a WSGI/ASGI problem.

image
image

The mimetype is still image/png and the PNG header still exists in the file.

image
image

This happens on both Gunicorn and Hypercorn, so it isn't a WSGI/ASGI problem. ![image](/attachments/e40c5cf9-3919-4afb-b9a9-75907d34e508) ![image](/attachments/f0fe77f3-9c7b-4f26-837e-94c77d4d4efc) The mimetype is still image/png and the `PNG` header still exists in the file. ![image](/attachments/6435985d-bc79-4bb5-a4b6-44ebb6224620) ![image](/attachments/34200028-1319-49cb-83a2-bcf70e6548d6)
Author
Owner

Commit 9d50847f97 fixed this issue.

Because it's using latin-1 if UTF-8 fails, it sees the PNG without errors and decides to try parsing.

So now when the mimetype isn't text/gemini, it will use the raw binary instead of the decoded data. (that is re-coded into UTF-8)

image

image

Commit [9d50847f97](https://git.swee.codes/swee/Gem2Browser/commit/9d50847f977b829b730aff816cfcaa78d5c84514) fixed this issue. Because it's using `latin-1` if `UTF-8` fails, it sees the PNG without errors and decides to try parsing. So now when the mimetype isn't `text/gemini`, it will use the raw binary instead of the decoded data. (that is re-coded into UTF-8) ![image](/attachments/11ea2289-4e7f-48d6-a170-39ca0560cf0b) ![image](/attachments/4b26b9bc-77b7-45e6-bd85-ff2f3a8a8c23)
swee closed this issue 2025-07-20 10:43:31 -07:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: swee/Gem2Browser#2
No description provided.