social-app icon indicating copy to clipboard operation
social-app copied to clipboard

Large images giving 'Only image files are supported' error.

Open oracularhades opened this issue 8 months ago • 1 comments

Putting this here to save someone the pain of investigating this javascript bullshit. This is not an issue that is worth and code changes.

Describe the bug https://bsky.app/profile/thiccass.pikachu.zone/post/3kuaez7figc2k

(I made the absurdly large image [in bluesky context] of 51MB to test this)

When uploading a large image, the client will give a toast error message of 'Only image files are supported'. This is because the client is checking mimeType, however, if the image is too big, sometimes the mimeType won't even get returned (probably for reasonable browser performance issues), it is just a null/undefined value. Here is where the check is occurring: https://github.com/bluesky-social/social-app/blob/1f954c106562bd79385248a3d1c119f5cbe48a9a/src/lib/media/picker.shared.ts#L27

I tried removing the image mimeType check, to see if we could just rely on the file picker settings to guide the user. However, if the image is ridiculously large, it will crash the gallery image (seemingly >60MB).

This isn't worth anyone's time, but if it becomes an issue in the future, someone can refer to this when fixing it.

To Reproduce

Steps to reproduce the behavior:

  1. Make an absurd image. An easy way to make a 51MB image (or around that, depending on the encoding), is to go into preview > tools > adjust size and set width/height to something ridiculous like 4944w 4514h pixels.
  2. Attempt to upload the image in the composer.

Expected behavior

Image uploads normally.

Screenshots

Screenshot 2024-06-06 at 9 36 12 PM

Additional context

oracularhades avatar Jun 06 '24 09:06 oracularhades