Skip to content

aws s3 cp with --metadata-directive REPLACE not guessing correct Content-Type #6895

Answered by stobrien89
bersalazar asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @bersalazar,

My apologies— I almost forgot you were needing to copy a single file rather than an entire directory.

So the 'correct' behavior is actually found in v2 for reasons I mentioned before— if you compare debug logs between v1 and v2 for aws s3 cp s3://src-bucket s3://dest-bucket --cache-control 'no-cache' --metadata-directive REPLACE, v1 actually sends the content-type header as a part of the copy request. REPLACE, in theory, should only have the metadata values that were specified by the CLI command.

In this case, you may be better off not specifying --metadata-directive REPLACE in v2, as the correct content-type is retained during the copy, or manually specify --content-type as

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tim-finnigan
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #6078 on April 22, 2022 22:44.