supabase/storage-js

Upload and Update with upsert seems to only work for Upload

silentworks opened this issue · 0 comments

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

It would seem this library is doing something odd and against what the docs are stating. The docs state that if you set the upsert option to true while using the update method it should overwrite the file, but in the codebase it would seem the x-upsert header which is what upsert changes to is only set when doing a POST request and not a PUT. This means that only on the upload method does this option have any effect.

To Reproduce

You can take a look at the method here: https://github.com/supabase/storage-js/blob/main/src/packages/StorageFileApi.ts#L84
You can have a look at the docs describing this here: https://supabase.com/docs/reference/javascript/storage-from-update?example=update-file

Expected behavior

when the upsert option is set to true when using the update method, it should set the x-upsert header.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.