Bam
08/01/2024, 9:38 AMimage_A.png
, a "folder" images
and a bucket artists
, when adding using the following code:
val storagePath = supabaseClient.storage.from("artists").upload(path = "images/image_A.png", data = file.readBytes())
the following path is returned artists/images/image_A.png
.
However, when attempting to delete using the returned string, using the following code:
supabaseClient.storage.from("artists").delete(path = storagePath)
the deletion is unsuccessful because the delete function will now be looking for artists/artists/images/image_A.png
.
My question is whether there is an easy way around this issue without having to do any string manipulation to the String returned by the add storage function?Bam
08/01/2024, 9:50 AMJan
08/01/2024, 10:00 AMWould there be any reason to just use the path provided to the upload method? ("images/image_A.png" instead of using the returned path.)The current return value is just what Supabase provides in their response. I'm not sure why you would use that in the scope of a client library (you could use that value 1:1 in a request:
https://id.supabase.co/storage/v1/bucket/folder/file.png▾
My question is whether there is an easy way around this issue without having to do any string manipulation to the String returned by the add storage function?Well, you can just use the parameter you put in the upload method, but we could change the return value to provide both.
Bam
08/01/2024, 10:03 AMJan
08/01/2024, 10:07 AMIf there is no chance of that ever happening, I can certainly use the inputted pathYes, you can safely use that. There will still probably be some changes to the return value to match the other client libs, but that doesn't matter for the actual file upload.
Bam
08/01/2024, 10:07 AM