logoalt Hacker News

lifislast Monday at 12:53 PM3 repliesview on HN

Obviously an image picker shouldn't leak filenames... The filename is a property of the directory entry storing the file storing the image. The image picker only grants access to the image, not to directories, directory entries or files.

If you want filenames, you need to request access to a directory, not to an image


Replies

siblast Monday at 1:51 PM

"Obviously"

There are plenty of use cases where the filename is relevant (and many, many people intentionally use the image name for sorting / cataloging).

show 2 replies
butlikelast Monday at 1:07 PM

The path is different than the filename though. If I want to find duplicates, it will be impossible if the filename changes. In my use case

/User/user/Images/20240110/happy_birthday.jpg

and

/User/user/Desktop/happy_birthday.jpg

are the same image.

show 3 replies
Terr_yesterday at 5:30 AM

It's not "obvious" at all, since it's contextual, it depends on the purpose and semantics of whatever service you're uploading the photo to.

Depending on how it'll be used next, not only can the current filename be important, I may even want to give something a custom filename with more data than before.