404 response when getting/deleting image with nested path

Hello!

I’ve tried to upload some images containing nested paths (e.g.: “skills/remix.webp”), but the upload process reversed the slash and the corresponding images’ ids now contain a back-slash instead of a front-slash (e.g.: “skills\remix.webp” instead of “skills/remix.webp”). Because of this, I get a 404 response if I try to get or delete the image.

Preview image URL example: https://imagedelivery.net/<ACCOUNT_HASH>/skills\remix.webp/public

I’m going to use a different approach for handling nested paths in my app, but I’d like to delete the images with invalid ids. Right now, if I try to delete them I get a 404 response (I’ve tried both, in the UI and by direct API request). How could I delete them?

Hi there!

the upload process reversed the slash and the corresponding images’ ids now contain a back-slash instead of a front-slash (e.g.: “skills\remix.webp” instead of “skills/remix.webp”)

This is not something we do on our end (converting forward slashes to backslashes in an image custom ID). To be sure I understand correctly, can you please confirm this is something that happened on your end during the upload process?

If the image custom ID contained a backslash when uploaded, it should be possible to access the image for delivery by encoding the backslash to %5C in the delivery URL; like so: https://imagedelivery.net/<ACCOUNT_HASH>/skills%5Cremix.webp/public

The deletion of images with backslash from the UI is something we’ve recently fixed and we’re about to release (it’s not yet rolled out in production). To delete your image using the CURL api, simply fully URL-encode your custom ID in your Images API calls (see Delete images · Cloudflare Image Optimization docs, API tab)

Please, let us know how it goes, and thank you for taking the time to report the issue!

The conversion from frontslashes to backslashes happened on my end (a tiny bug in my upload logic), sorry for the confusion.

I’ve tried the workaround using %5C instead of a backslash in a URL and it worked! Thank you for your help! Issue solved :smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.