Storage download (storage.from.download url) is cached in the CDN even for deleted file
See original GitHub issueBug report
It is desirable to cache image and some file urls. The storage download function though seems more like a database call to get the file data from the database/storage system. A deleted file from storage (no object and data) will still download when called with supabase.storage download. Cache busting with ?bust=123 in the path provided to download does return 404. The download url does not appear to be cached in the browser, using a 2nd browser will still return a file even though deleted and never used on the browser. After 1 hour the download function does get a 404 error.
To Reproduce
Create a file in the UI in a private bucket. Download it with:
.storage
.from('avatars')
.download('folder/avatar1.png')
Delete the file. Run the download code on any browser and file still downloads.
Expected behavior
This behavior should at least be documented as it is not clear download is cached by it appears just the CDN. Or download should not be cached at all as it is more like a database call then a url for an image.
Screenshots
System information
Latest Supabase instance and supabase.js code.
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
You need to do the cache busting string added at end with time. ?bust=95857573738 for now.
Well, In that case you can store something as update_time under your Database, (as we prefer to do, when we update anything…right !), and use that as a reference under any image url (let say
<Image_url>?t=<update_time>
), that will reduce a lot many hits, and also able to use cached file