Skip to content
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

Copy object does not update content type #628

Open
2 tasks done
ibash opened this issue Feb 1, 2025 · 1 comment
Open
2 tasks done

Copy object does not update content type #628

ibash opened this issue Feb 1, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@ibash
Copy link

ibash commented Feb 1, 2025

Duplicate of #580 and #611 . The issue remains unfixed.

I'm guessing it's becauseMetadataDirective is not being set correctly.

ref: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/CopyObjectCommand/

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

Case 1:
Steps:

  1. Copy object to a new key with a new content-type
  2. Curl the url of the new key
  3. Inspect the object in the supabase dashboard

Expected:
content-type header returned from curl are the new content type
mimetype in supabase is updated

Actual:
content-type header returned from curl is the old content type
mimetype in supabase is updated
In this case the content-type and supabase mimetype don't match

Case 2:
Steps:

  1. Copy object to the same key, but with the same content-type
  2. Curl the url of the key
  3. Inspect the object in the supabase dashboard

Expected:
content-type header returned from curl are the new content type
mimetype in supabase is updated

Actual:
Neither the content-type header or the mimetype are updated, they're both the old value

To Reproduce

  1. Upload an object to supabase storage with content-type "text/plain"
  2. Overwrite the object via the s3 protocol, but specify an alternative content type like "audio/mp4"
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)

Expected behavior

Content-type when curling and mimetype in supabase are both updated.

Additional context

This is a continuation of #580, but creating a new issue so it's not missed since that was marked completed.

@ibash ibash added the bug Something isn't working label Feb 1, 2025
@ibash
Copy link
Author

ibash commented Feb 25, 2025

@fenos any chance we can get a fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant