docs(storage_management): fix delete_old_avatar#15530
Merged
saltcod merged 3 commits intosupabase:masterfrom Sep 1, 2023
Merged
docs(storage_management): fix delete_old_avatar#15530saltcod merged 3 commits intosupabase:masterfrom
saltcod merged 3 commits intosupabase:masterfrom
Conversation
|
@grafovdenis is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
saltcod
approved these changes
Sep 1, 2023
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
|
Deployment failed with the following error: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
It fixes
delete_old_avatarusage.What is the current behavior?
We have
avatarsbucket, andavatar_urlfield inpublic.profilestable and triggerdelete_old_avatar, which usesdelete_avatar, which usesdelete_storage_object.Once we edit the
avatar_url, related storage object should be removed.But it doesn't happend, because
delete_old_avatartakesold.delete_old_avatar, which looks likehttps://project_id.supabase.co/storage/v1/object/sign/avatars/avatar_id.jpg?token=some_tokenand puts it intodelete_avatar, which callsdelete_storage_objectand instead ofavatar_id.jpgwe provide full URL.In a result, even if we change or remove
avatar_url, previous avatars remain in the storage. Because we'll have 404 error inDELETEHTTP request.What is the new behavior?
Intead of
avatar_url,avatar_nameis now provided todelete_avatarindelete_old_avatartrigger.Which makes it work as supposed.
If we edit
avatar_url, old avatar would be deleted from the storage.