How to know if a public url doesn't exist?
Im trying to fetch a user's avatar from the public bucket.
I wish to know whether the URL is valid or not so that I could use a default URL in case url is invalid. How to achieve this?
2 Replies
You have to write a postgres function to check the storage.objects table for the path. Then call that with an rpc call.
getPublicUrl is just a helper and does not call the storage server.
try to fetch image see if actually exists such as bytes or what response is from server
another simple thing to do is save avatar as
avatar-userId.png and build url from that