picosh / pico

hacker labs - open source and managed web services leveraging SSH
https://pico.sh
MIT License
741 stars 25 forks source link

Extensionless image not display properly on Safari & macOS <= 10.15 #110

Open imcotton opened 3 months ago

imcotton commented 3 months ago

Screen shot taken from Safari (15.6) on macOS Catalina (10.15):

image missing

BTW, I reported this in issue #104 a couple of days back as follow up comment, seems been slipped due to ticket closed automatically, thus opening the new one instead.

neurosnap commented 3 months ago

Thanks for the ping. How do you think we should handle this issue? We could sniff the User-Agent and fallback to default mime-type for the image. Thoughts?

imcotton commented 3 months ago

I always handle images with extensions on the web. However, in rare cases like this, options in my mind:

  1. original mime type: mostly jpeg or png, obtained during the upload process

  2. do nothing, as for authors deliberately opt-in to the extensionless practice, and knowingly acknowledge the lack of support for users under Safari & macOS <= 10.15 (via statistics)

  3. sniffing, from the user-agent

I think option 1 is the safe move. For option 2 need some way to inform the authors beforehand. I don't have any experience with Option 3, but it seems to make things even more tricky.

imcotton commented 3 months ago

I just noticed, as normal user, you can not upload files without extensions, so the impact / problem scope is limited to admins?