cmj2002 / r2-dir-list

Directory Listing for Cloudflare R2
MIT License
24 stars 8 forks source link

Error with folders containing spaces #2

Closed RCAFinfo closed 4 weeks ago

RCAFinfo commented 1 month ago

I have to say this project has been the biggest blessing. It has saved me at least 1 hour in the last week. I did run into a small snag. In the R2 bucket your are able to have file names containing characters like the space " ". I have found that and folder containing this character creates a 404 error. as an example the folder..."https://publications.rcaf.info/Brandon%20-%20Airmans%20Post/" which is displayed as "Brandon - Airmans Post" this may have been brought on with a recent update to Cloudflares R2.

To see this error please check out "https://publications.rcaf.info/"

Thank you again for developing this tool.

Nathan

cmj2002 commented 1 month ago

Thank you for reporting this issue! This is because I did not consider special characters in object keys when writing code.

Decoding URI may cause other problems, because other users may expect a exact match of object key. I may create a new flag for users to decide whether to decode URI before processing key.

I am on my vacation now and I will fix this once I am back (next Monday) . Sorry for the delay.

cmj2002 commented 4 weeks ago

You can enable the new decodeURI option to allow spaces and other special characters in object keys.