Closed ibash closed 1 week ago
When copying an object via the S3 protocol, and specifying a new content-type, the object is not updated with the new content type.
import { S3Client, CopyObjectCommand } from "@aws-sdk/client-s3"; const client = new S3Client({ forcePathStyle: true, region: "us-west-1", endpoint: "supabase-s3-endpoint", credentials: { accessKeyId: process.env.ACCESS_KEY_ID, secretAccessKey: process.env.SECRET_ACCESS_KEY, }, }); const bucket = 'my-bucket' const key = 'my-key.m4a' const command = new CopyObjectCommand({ Bucket: bucket, CopySource: `${bucket}/${key}`, Key: key, ContentType: 'audio/mp4' }); const data = await client.send(command); console.log('data is ', data)
After copying the object, the new object should have an update content-type. If you check via curl or via the supabase ui you'll see the content-type has not changed.
I looked through the code and it seems like setting the new content-type isn't implemented, even though the docs say that it is supported: https://github.com/supabase/storage/blob/6b052d85b9f0c7eb2442a0377b49ca058a5809af/src/http/routes/s3/commands/copy-object.ts#L32 https://github.com/supabase/storage/blob/6b052d85b9f0c7eb2442a0377b49ca058a5809af/src/storage/protocols/s3/s3-handler.ts#L1020
https://supabase.com/docs/guides/storage/s3/compatibility
@ibash thanks a lot for reporting this! will send a PR asap
:tada: This issue has been resolved in version 1.12.2 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Bug report
Describe the bug
When copying an object via the S3 protocol, and specifying a new content-type, the object is not updated with the new content type.
To Reproduce
Expected behavior
After copying the object, the new object should have an update content-type. If you check via curl or via the supabase ui you'll see the content-type has not changed.
Additional context
I looked through the code and it seems like setting the new content-type isn't implemented, even though the docs say that it is supported: https://github.com/supabase/storage/blob/6b052d85b9f0c7eb2442a0377b49ca058a5809af/src/http/routes/s3/commands/copy-object.ts#L32 https://github.com/supabase/storage/blob/6b052d85b9f0c7eb2442a0377b49ca058a5809af/src/storage/protocols/s3/s3-handler.ts#L1020
https://supabase.com/docs/guides/storage/s3/compatibility