pavben / InstantShare

Instantly share images, videos, and other files on the web
MIT License
15 stars 1 forks source link

File extensions should be canonicalized (made lowercase?). #31

Open dmitshur opened 7 years ago

dmitshur commented 7 years ago

I had an image on my desktop that I acquired via a 3rd party software (Photos.app). I did not control its filename or extension, and it happened to be IMG_2878.PNG.

I uploaded the image file to Instant Share and it gave me a URL like this:

http://instantshare.win/1vr26ftdzmi5q.PNG

Note that the filename is replaced by a random ID that Instant Share choses, but the file extension is kept as is.

I didn't want to the URL to look ugly when sharing, so I modified it to be nicer:

http://instantshare.win/1vr26ftdzmi5q.png

And shared that. But it's 404.

I think a good solution is to canonicalize the file extensions in the generated filenames. Most likely by making it all lower case, always.

Any issues with that solution?

pavben commented 7 years ago

Go for it. Perhaps feed the extension through a canonicalizer function that could at some point also force jpg/jpeg into one consistent extension.