-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storage upsert docs are incorrect #693
Comments
Yes you are correct here about the docs being out of date. You should use |
@silentworks Is the preference to update the documentation or to add upsert as a compatible property? |
The preference is to update the upsert. But note we need to keep the |
I'm working on a proposal and hopefully have a PR for review soon. |
Well, what I thought would be a simple PR turned out to be not so and I need some guidance. Original requesting is noting that documentation for update allows the upsert option, but underlying client only accept x-upsert. I thought I had a solution, but then did some testing and realized that UPDATE on the server side (PUT) actually ignores the upsert option in either form. It feels like we should clean up the documentation to remove it. The upload (POST) has the issue with upsert vs. x-upsert. So it seems like we want to update https://supabase.com/docs/reference/python/storage-from-upload when a POST is called. Thoughts @silentworks? Am I missing something? |
If update is ignoring the upsert part completely then this is a bug and should be addressed first. I'm going to test this out in my project code and see if it's ignoring the |
@clefelhocz2 I tested if file_options.get('upsert'):
file_options.update({'x-upsert': file_options.get('upsert')}) So in this we are checking if |
Okay I added supabase/storage-py#199 based on your guidance. This is one case where a conversation may have been useful. I'd be curious what you tested. When I tested against production I got the following behavior: Call update with x-upsert = true -> 200 success What I was questioning was the server responding with 200 on a update and upsert set to false. Looking at uploadOrUpdate in https://github.com/supabase/storage-js/blob/main/src/packages/StorageFileApi.ts#L84 shows that x-upsert is only added on POST operations (upload). At least that was what I was reading. |
This has been fixed thanks to @clefelhocz2. |
Describe the bug
The docs on how to control storage upserts are out of date.
The docs say that an
upsert
header is allowedhttps://supabase.com/docs/reference/python/storage-from-update
But the underlying storage3 lib accepts an
x-upsert
param not anupsert
https://github.com/supabase-community/storage-py/blob/main/storage3/constants.py#L12
cc @olirice
The text was updated successfully, but these errors were encountered: