Hey guys, it seems that i uploaded some JPG images...
# help
b
Hey guys, it seems that i uploaded some JPG images with a ".png" extension and with the "image/png" mimeType, is there any way i could update the name with the new .jpg extension and new mimetype? I tried to update the objects table but it gives me an error when trying to download the image via supabase studio
n
Hello @Bicijay! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
o
Hi Which error are you getting? @Bicijay
b
This one for example, its original name ended with ".png" and its original mimetype was "image/png" i manually changed it in the objects table to .jpg and "image/jpeg" but now i get a 400 when i try to download it
o
Did you try to click on the reload button?
b
yep
o
hmmm, what happen if you reload the whole page?
b
same thing, perhaps cache?
o
it is possible indeed
b
but client cache or server cache?
tried with another browser no luck
if i change the name back to the ".png" ending, it works again even with the "image/jpeg" mimetype
o
It looks like the server won't to take the update
b
but is there any trigger in the objects table to update s3 after a update?
o
I guess
Looks like this issue is related to yours https://github.com/supabase/supabase/issues/5974
b
one thing tho, im updating it straight from a sql client
i dont know if that makes a difference
g
You can add a "cache buster" string ?t=12343545454 to your download url to see if it is cached or not. The CDN also caches, so other browsers would not matter.
b
appended a &t in the end of the url
One thing i dont get it, how you guys update the cdn when i update the table? i didnt find any triggers in the db
g
I don't think it does, but "you guys" does not apply to us mods. We have same access as you.
b
oh didnt know that, i will create a little script calling the .copy method from the js lib for now, i think it will work
but thanks for the help!
Im back, so i created a script that would move the old files to a new filename with the correct extension
but now a lot of those images are returning error 400
some work and some dont, pretty random
g
I was just looking back thru the start of this as I came in at the caching part... When you renamed the file in the object table, you lost the link to the actual file in storage. It did not get renamed. You might be able to get it back by putting the name back in the object to .png and see if it returns then do the proper move or copy call thru the storage interface which does both. Edit: I see you did that at least once early on. There is no trigger to update the name in storage for changes to the object table. It must be done thru storage calls.
As far as caching in CDN goes, does not appear any progress has been made on these reported issues: https://github.com/supabase/storage-api/issues/120 https://github.com/supabase/storage-api/issues/116
n
Thread was archived by @Bicijay. Anyone can send a message to unarchive it.