supabase / storage

S3 compatible object storage service that stores metadata in Postgres
https://supabase.com/docs/guides/storage
Apache License 2.0
764 stars 107 forks source link

Move set owner to null #432

Closed wdavidw closed 5 months ago

wdavidw commented 7 months ago

Bug report

While upgrading our application with the latest Docker files, we encountered a few issues:

Describe the bug

When using supabase.storage.from(...).move, the owner field is set to null.

To Reproduce

This is how to reproduce the bug

await Promise.all(files.map( async file => {
  Promise.resolve()
  .then(async() => {
    const { data, error } = await supabaseClient
      .storage.from('kb_document_assets')
      .upload(
          `staging/${user.id}/${file.name}`,
          file
        )
    console.log('upload', data, error)
    return data
  })
  .then(async(upload) => {
    const { data, error } = await supabaseClient
      .storage.from('kb_document_assets')
      .move(
          upload.path,
          upload.path+'.test'
        )
    console.log('move', data, error)
  })
}))

From the studio console, the owner field is now null.

Expected behavior

The owner field should be associated with the Supabase client authenticated user.

System information

Our packages.json file includes

{...
    "@supabase/auth-helpers-nextjs": "^0.9.0",
    "@supabase/auth-helpers-react": "^0.4.2",
    "@supabase/ssr": "^0.1.0",
    "@supabase/supabase-js": "^2.39.3",
...}

Here are the container image versions:

Additional context

We are using the file storage backend.

I do not think my policy is to blame, it is also working fine with the previous version (around march 2023):

CREATE POLICY "Project assets are administered with document access."
  ON "storage"."objects"
  AS PERMISSIVE FOR ALL TO public
  USING (
    bucket_id = 'kb_document_assets' and auth.uid() IS NOT NULL
  )
  WITH CHECK (
    bucket_id = 'kb_document_assets' and auth.uid() IS NOT NULL
  );
fenos commented 5 months ago

This is now fixed