s3cmd sync: Remote copy does not respect mime type
Steps:
- Using s3cmd, upload a .js file to folder A, but force a mime type of text/plain
- Upload the same .js file to folder B, but allow s3cmd to automatically set the mime type
Result: remote copy A/file.js -> B/file.js (md5 matches as expected). However B/file.js has mime type of text/plain.
Expected: B/file.js exists with mime type application/javascript.
Either the remote copy logic should take the mime type into account, setting the mimetype on the copied file, or remote copy should be disabled if the mime type of the source file and the mime type of the uploaded file differs. This bug causes a cascading problem where once a file is uploaded with an incorrect mime type, the only way to fix it is to either delete the source files to prevent further copying of bad mime types or manually go through all the files and update their mime types.
Uploading a new file with the intended mime type should always result in that file being there with the specified mime type.
Is this in 1.6.0? I thought I had fixed this. On Oct 5, 2015 5:13 PM, "Darrick Brown" [email protected] wrote:
Steps:
- Using s3cmd, upload a .js file to folder A, but force a mime type of text/plain
- Upload the same .js file to folder B, but allow s3cmd to automatically set the mime type
Result: remote copy A/file.js -> B/file.js (md5 matches as expected). However B/file.js has mime type of text/plain.
Expected: B/file.js exists with mime type application/javascript.
Either the remote copy logic should take the mime type into account, setting the mimetype on the copied file, or remote copy should be disabled if the mime type of the source file and the mime type of the uploaded file differs. This bug causes a cascading problem where once a file is uploaded with an incorrect mime type, the only way to fix it is to either delete the source files to prevent further copying of bad mime types or manually go through all the files and update their mime types.
Uploading a new file with the intended mime type should always result in that file being there with the specified mime type.
— Reply to this email directly or view it on GitHub https://github.com/s3tools/s3cmd/issues/643.
Yes. 1.6.0 is what I'm using. Sorry for not including that information. I'm on Mac 10.10.5. Python 2.7.10.
I see this problem also, with 1.6.0. For instance, I just uploaded a new foo.css file using sync, and its mime type becomes set on amazon to text/plain instead of text/css.
@jdberry That's a different problem. It's a problem with python-magic producing incorrect mime-types. You can work around it by supplying the --no-mime-magic and --guess-mime-type options to s3cmd. https://github.com/s3tools/s3cmd/issues/198
Unfortunately setting --no-mime-magic --guess-mime-type doesn't work for me. Is there anything else I could do about this?
I'm using the following s3cmd build: https://github.com/schickling/dockerfiles/tree/master/s3cmd
@schickling I had the same issue and found this thread.
My hypothesis is that S3CMD is not diffing correctly on MIME type. Specifically, running --no-mime-magic --guess-mime-type did not fix my CSS issue. However, when I manually removed the CSS file from S3, on the subsequent upload S3CMD added it with the correct MIME type.
So - to the S3CMD team, please check diffing.
@schickling - try emptying the bucket then retrying.
s3cmd does not check if content type differs, only md5sum or file size, when comparing files for [sync]. I suppose that would be an attribute sync. We don't get the content type back in a normal object store listing, which means we would have to do an individual HEAD call for each object to get it, which is both very slow, and somewhat expensive (AWS charges a tiny amount per HEAD API call, and for a large bucket, that could translate into real costs).
On Sun, Nov 22, 2015 at 10:59 PM, Philip I. Thomas <[email protected]
wrote:
@schickling https://github.com/schickling I had the same issue and found this thread.
My hypothesis is that S3CMD is not diffing correctly on MIME type. Specifically, running --no-mime-magic --guess-mime-type did not fix my CSS issue. However, when I manually removed the CSS file from S3, on the subsequent upload S3CMD added it with the correct MIME type.
So - to the S3CMD team, please check diffing.
@schickling https://github.com/schickling - try emptying the bucket then retrying.
— Reply to this email directly or view it on GitHub https://github.com/s3tools/s3cmd/issues/643#issuecomment-158854152.
Interesting. perhaps there should be a --dangerously-check-content-type option that does this or something.
Is there any workaround for this problem? e.g. Any way to disable the remote copy when using s3cmd sync?
If I understand the request, you want the copy to have the same MIME type as the original, yes? Using master branch now, that seems to be the case:
[mdomsch@localhost s3cmd (master u=)]$ ./s3cmd info s3:// s3cmd-test.domsch.com/checksum.tar s3://s3cmd-test.domsch.com/checksum.tar (object): File size: 10240 Last mod: Sun, 16 Aug 2015 17:32:05 GMT MIME type: application/x-tar Storage: STANDARD MD5 sum: 282e98241b6fe2edefe25f4dfbabb0f1 SSE: none policy: none cors: none ACL: mdomsch: FULL_CONTROL x-amz-meta-s3cmd-attrs: uid:500/gname:mdomsch/uname:mdomsch/gid:500/mode:33188/mtime:1293111006/atime:1431308136/md5:282e98241b6fe2edefe25f4dfbabb0f1/ctime:1431308136
[mdomsch@localhost s3cmd (master u=)]$ ./s3cmd cp s3:// s3cmd-test.domsch.com/checksum.tar s3://s3cmd-test.domsch.com/checksum2.tar remote copy: 's3://s3cmd-test.domsch.com/checksum.tar' -> 's3:// s3cmd-test.domsch.com/checksum2.tar'
[mdomsch@localhost s3cmd (master u=)]$ ./s3cmd info s3:// s3cmd-test.domsch.com/checksum2.tar s3://s3cmd-test.domsch.com/checksum2.tar (object): File size: 10240 Last mod: Thu, 09 Jun 2016 22:40:49 GMT MIME type: application/x-tar Storage: STANDARD MD5 sum: 282e98241b6fe2edefe25f4dfbabb0f1 SSE: none policy: none cors: none ACL: mdomsch: FULL_CONTROL ACL: anon: READ URL: http://s3cmd-test.domsch.com.s3.amazonaws.com/checksum2.tar x-amz-meta-s3cmd-attrs: uid:500/gname:mdomsch/uname:mdomsch/gid:500/mode:33188/mtime:1293111006/atime:1431308136/md5:282e98241b6fe2edefe25f4dfbabb0f1/ctime:1431308136
I don't see any changes since 1.6.0 that would have changed that behavior, so I expect 1.6.0 behaved the same.
On Thu, Jun 9, 2016 at 5:09 PM, Ghazgkull [email protected] wrote:
Is there any workaround for this problem? e.g. Any way to disable the remote copy when using s3cmd sync?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/s3tools/s3cmd/issues/643#issuecomment-225041900, or mute the thread https://github.com/notifications/unsubscribe/AAqDqoTEEkiDjSfWWlmoJzN451ykYkCfks5qKI8JgaJpZM4GJW7B .
Hmm. Well, we were using whatever happened to get installed by apt-get in our build process, which was 1.5.0~rc1-2, so I can't comment on how 1.6.0 behaves. For our use-case (simply trying to upload static assets to S3 during our build), it's looking like the AWS CLI will get the job done.
Ah, I understand now. You don't want it copy the mime-type from the original file in S3 (text/plain) (which is what the copy_object() routine does, just copy the data, but use locally discovered mime type for file B. Ugh. No. There's no good provision for this. It winds up being 2 commands then: a copy (via sync), followed by a modify, because it somehow figured out that the second file shouldn't have the original metadata.
If aws cli works for you, please use that. I'm curious now how they do it...
On Thu, Jun 9, 2016 at 5:43 PM, Matt Domsch [email protected] wrote:
If I understand the request, you want the copy to have the same MIME type as the original, yes? Using master branch now, that seems to be the case:
[mdomsch@localhost s3cmd (master u=)]$ ./s3cmd info s3:// s3cmd-test.domsch.com/checksum.tar s3://s3cmd-test.domsch.com/checksum.tar (object): File size: 10240 Last mod: Sun, 16 Aug 2015 17:32:05 GMT MIME type: application/x-tar Storage: STANDARD MD5 sum: 282e98241b6fe2edefe25f4dfbabb0f1 SSE: none policy: none cors: none ACL: mdomsch: FULL_CONTROL x-amz-meta-s3cmd-attrs: uid:500/gname:mdomsch/uname:mdomsch/gid:500/mode:33188/mtime:1293111006/atime:1431308136/md5:282e98241b6fe2edefe25f4dfbabb0f1/ctime:1431308136
[mdomsch@localhost s3cmd (master u=)]$ ./s3cmd cp s3:// s3cmd-test.domsch.com/checksum.tar s3:// s3cmd-test.domsch.com/checksum2.tar remote copy: 's3://s3cmd-test.domsch.com/checksum.tar' -> 's3:// s3cmd-test.domsch.com/checksum2.tar'
[mdomsch@localhost s3cmd (master u=)]$ ./s3cmd info s3:// s3cmd-test.domsch.com/checksum2.tar s3://s3cmd-test.domsch.com/checksum2.tar (object): File size: 10240 Last mod: Thu, 09 Jun 2016 22:40:49 GMT MIME type: application/x-tar Storage: STANDARD MD5 sum: 282e98241b6fe2edefe25f4dfbabb0f1 SSE: none policy: none cors: none ACL: mdomsch: FULL_CONTROL ACL: anon: READ URL: http://s3cmd-test.domsch.com.s3.amazonaws.com/checksum2.tar x-amz-meta-s3cmd-attrs: uid:500/gname:mdomsch/uname:mdomsch/gid:500/mode:33188/mtime:1293111006/atime:1431308136/md5:282e98241b6fe2edefe25f4dfbabb0f1/ctime:1431308136
I don't see any changes since 1.6.0 that would have changed that behavior, so I expect 1.6.0 behaved the same.
On Thu, Jun 9, 2016 at 5:09 PM, Ghazgkull [email protected] wrote:
Is there any workaround for this problem? e.g. Any way to disable the remote copy when using s3cmd sync?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/s3tools/s3cmd/issues/643#issuecomment-225041900, or mute the thread https://github.com/notifications/unsubscribe/AAqDqoTEEkiDjSfWWlmoJzN451ykYkCfks5qKI8JgaJpZM4GJW7B .
I would be fine with it copying the mime-type from the original file. If I run a sync with a new CSS file, it correctly gets uploaded with Content-Type='text/css'. But then if I run a sync with a local copy of that CSS file, s3cmd ends up running a remote copy of the first file... with the new file having Content-Type='binary/octet-stream'. I want the copied file to have the same Content-Type of the original: 'text/css'.
Can you provide an example run with --debug? I'm not sure how/where it's picking up the Content-Type="binary/octet-stream". It should have been 'text/css' just like the original. A run with --debug should show that.
Thanks, Matt
On Thu, Jun 9, 2016 at 5:55 PM, Ghazgkull [email protected] wrote:
I would be fine with it copying the mime-type from the original file. If I run a sync with a new CSS file, it correctly gets uploaded with Content-Type='text/css'. But then if I run a sync with a local copy of that CSS file, s3cmd ends up running a remote copy of the first file... with the new file having Content-Type='binary/octet-stream'. I want the copied file to have the same Content-Type of the original: 'text/css'.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/s3tools/s3cmd/issues/643#issuecomment-225050899, or mute the thread https://github.com/notifications/unsubscribe/AAqDqs5zsKPe594Jif6Bv13jljDlQTEaks5qKJnpgaJpZM4GJW7B .
@mdomsch We're now having the same issue; remote copy is somehow setting the mime type to text/plain, as shown in this Chrome console error (domain redacted):
Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://foobar.com/assets/css/component-presentation-628d1185fb.min.css".
The --dubug output for that specific file looks like this:
16:08:23 DEBUG: Remote Copying from assets/css/component-presentation-628d1185fb.min.css to assets/css/component-presentation.min.css
16:08:23 DEBUG: String 'assets/css/component-presentation-628d1185fb.min.css' encoded to 'assets/css/component-presentation-628d1185fb.min.css'
16:08:23 DEBUG: CreateRequest: resource[uri]=/assets/css/component-presentation-628d1185fb.min.css?acl
16:08:23 DEBUG: Using signature v4
16:08:23 DEBUG: get_hostname(my-bucket): my-bucket.s3.amazonaws.com
16:08:23 DEBUG: canonical_headers = host:my-bucket.s3.amazonaws.com
16:08:23 x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
16:08:23 x-amz-date:20160624T150823Z
16:08:23
16:08:23 DEBUG: Canonical Request:
16:08:23 GET
16:08:23 /assets/css/component-presentation-628d1185fb.min.css
16:08:23 acl=
16:08:23 host:my-bucket.s3.amazonaws.com
16:08:23 x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
16:08:23 x-amz-date:20160624T150823Z
16:08:23
16:08:23 host;x-amz-content-sha256;x-amz-date
16:08:23 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
16:08:23 ----------------------
16:08:23 DEBUG: signature-v4 headers: {'x-amz-content-sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': 'AWS4-HMAC-SHA256 Credential=AKIAJCORVRBCMMRL3ZAA/20160624/eu-west-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=bc968c2a3356035d13d96023f281d9734b74f44d81bfc32975974370ee4af681', 'x-amz-date': '20160624T150823Z'}
16:08:23 DEBUG: Processing request, please wait...
16:08:23 DEBUG: get_hostname(my-bucket): my-bucket.s3.amazonaws.com
16:08:23 DEBUG: ConnMan.get(): re-using connection: https://my-bucket.s3.amazonaws.com#30
16:08:23 DEBUG: format_uri(): /assets/css/component-presentation-628d1185fb.min.css?acl
16:08:23 DEBUG: Sending request method_string='GET', uri='/assets/css/component-presentation-628d1185fb.min.css?acl', headers={'x-amz-content-sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': 'AWS4-HMAC-SHA256 Credential=AKIAJCORVRBCMMRL3ZAA/20160624/eu-west-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=bc968c2a3356035d13d96023f281d9734b74f44d81bfc32975974370ee4af681', 'x-amz-date': '20160624T150823Z'}, body=(0 bytes)
16:08:23 DEBUG: Response: {'status': 200, 'headers': {'x-amz-id-2': '4Z4ST7mKkLLJHn1kJtXxUo2h6hQHpFUbU1RJua9bBVS2NNW6jLRYPiT+raHUIvlgBmi0/xEznEc=', 'server': 'AmazonS3', 'transfer-encoding': 'chunked', 'x-amz-request-id': '9663CF1C67A9D4C0', 'date': 'Fri, 24 Jun 2016 15:08:25 GMT', 'content-type': 'application/xml'}, 'reason': 'OK', 'data': '<?xml version="1.0" encoding="UTF-8"?>\n<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>aa9addf4264cce765294bd6caba91104015342cfb65b8b7981dec65828138a10</ID><DisplayName>servicedesk</DisplayName></Owner><AccessControlList><Grant><Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>aa9addf4264cce765294bd6caba91104015342cfb65b8b7981dec65828138a10</ID><DisplayName>servicedesk</DisplayName></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>'}
16:08:23 DEBUG: ConnMan.put(): connection put back to pool (https://my-bucket.s3.amazonaws.com#31)
16:08:23 DEBUG: String 'assets/css/component-presentation-628d1185fb.min.css' encoded to 'assets/css/component-presentation-628d1185fb.min.css'
16:08:23 DEBUG: String 'assets/css/component-presentation.min.css' encoded to 'assets/css/component-presentation.min.css'
16:08:23 DEBUG: CreateRequest: resource[uri]=/assets/css/component-presentation.min.css
16:08:23 DEBUG: Using signature v4
16:08:23 DEBUG: get_hostname(my-bucket): my-bucket.s3.amazonaws.com
16:08:23 DEBUG: canonical_headers = host:my-bucket.s3.amazonaws.com
16:08:23 x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
16:08:23 x-amz-copy-source:/my-bucket/assets/css/component-presentation-628d1185fb.min.css
16:08:23 x-amz-date:20160624T150823Z
16:08:23 x-amz-metadata-directive:COPY
16:08:23 x-amz-storage-class:STANDARD
16:08:23
16:08:23 DEBUG: Canonical Request:
16:08:23 PUT
16:08:23 /assets/css/component-presentation.min.css
16:08:23
16:08:23 host:my-bucket.s3.amazonaws.com
16:08:23 x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
16:08:23 x-amz-copy-source:/my-bucket/assets/css/component-presentation-628d1185fb.min.css
16:08:23 x-amz-date:20160624T150823Z
16:08:23 x-amz-metadata-directive:COPY
16:08:23 x-amz-storage-class:STANDARD
16:08:23
16:08:23 host;x-amz-content-sha256;x-amz-copy-source;x-amz-date;x-amz-metadata-directive;x-amz-storage-class
16:08:23 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
16:08:23 ----------------------
16:08:23 DEBUG: signature-v4 headers: {'x-amz-content-sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'x-amz-date': '20160624T150823Z', 'x-amz-storage-class': 'STANDARD', 'x-amz-copy-source': '/my-bucket/assets/css/component-presentation-628d1185fb.min.css', 'Authorization': 'AWS4-HMAC-SHA256 Credential=AKIAJCORVRBCMMRL3ZAA/20160624/eu-west-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-copy-source;x-amz-date;x-amz-metadata-directive;x-amz-storage-class,Signature=5b2876478e5755f38ab762439c8197fee7a06d1e12429398ef36d11bdc2f17ed', 'x-amz-metadata-directive': 'COPY'}
16:08:23 DEBUG: Processing request, please wait...
16:08:23 DEBUG: get_hostname(my-bucket): my-bucket.s3.amazonaws.com
16:08:23 DEBUG: ConnMan.get(): re-using connection: https://my-bucket.s3.amazonaws.com#31
16:08:23 DEBUG: format_uri(): /assets/css/component-presentation.min.css
16:08:23 DEBUG: Sending request method_string='PUT', uri='/assets/css/component-presentation.min.css', headers={'x-amz-content-sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'x-amz-date': '20160624T150823Z', 'x-amz-storage-class': 'STANDARD', 'x-amz-copy-source': '/my-bucket/assets/css/component-presentation-628d1185fb.min.css', 'Authorization': 'AWS4-HMAC-SHA256 Credential=AKIAJCORVRBCMMRL3ZAA/20160624/eu-west-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-copy-source;x-amz-date;x-amz-metadata-directive;x-amz-storage-class,Signature=5b2876478e5755f38ab762439c8197fee7a06d1e12429398ef36d11bdc2f17ed', 'x-amz-metadata-directive': 'COPY'}, body=(0 bytes)
16:08:23 DEBUG: Response: {'status': 200, 'headers': {'content-length': '234', 'x-amz-id-2': 'BCRIWm1JamFszGgGPbD1vrN8RLLAfQ/qpAlU/rvzEUyYrWQzIuWTdJqLwYyRjFiMnBlKrRnWFyM=', 'server': 'AmazonS3', 'x-amz-request-id': '09D47A8ACF28A8C7', 'date': 'Fri, 24 Jun 2016 15:08:25 GMT', 'content-type': 'application/xml'}, 'reason': 'OK', 'data': '<?xml version="1.0" encoding="UTF-8"?>\n<CopyObjectResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LastModified>2016-06-24T15:08:25.000Z</LastModified><ETag>"628d1185fbe5ae3c06d13eadd205b5c1"</ETag></CopyObjectResult>'}
16:08:23 DEBUG: ConnMan.put(): connection put back to pool (https://my-bucket.s3.amazonaws.com#32)
16:08:23 DEBUG: set_acl(s3://my-bucket/assets/css/component-presentation.min.css): acl-xml: <AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>aa9addf4264cce765294bd6caba91104015342cfb65b8b7981dec65828138a10</ID></Owner><AccessControlList><Grant><Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>aa9addf4264cce765294bd6caba91104015342cfb65b8b7981dec65828138a10</ID></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>
16:08:23 DEBUG: String 'assets/css/component-presentation.min.css' encoded to 'assets/css/component-presentation.min.css'
16:08:23 DEBUG: CreateRequest: resource[uri]=/assets/css/component-presentation.min.css?acl
16:08:23 DEBUG: Using signature v4
16:08:23 DEBUG: get_hostname(my-bucket): my-bucket.s3.amazonaws.com
16:08:23 DEBUG: canonical_headers = content-type:application/xml
16:08:23 host:my-bucket.s3.amazonaws.com
16:08:23 x-amz-content-sha256:7b66bf58a169f2942abb1ad9ea6ac71fae86391d74748cf60be8b2fefba0d165
16:08:23 x-amz-date:20160624T150823Z
16:08:23
16:08:23 DEBUG: Canonical Request:
16:08:23 PUT
16:08:23 /assets/css/component-presentation.min.css
16:08:23 acl=
16:08:23 content-type:application/xml
16:08:23 host:my-bucket.s3.amazonaws.com
16:08:23 x-amz-content-sha256:7b66bf58a169f2942abb1ad9ea6ac71fae86391d74748cf60be8b2fefba0d165
16:08:23 x-amz-date:20160624T150823Z
16:08:23
16:08:23 content-type;host;x-amz-content-sha256;x-amz-date
16:08:23 7b66bf58a169f2942abb1ad9ea6ac71fae86391d74748cf60be8b2fefba0d165
16:08:23 ----------------------
16:08:23 DEBUG: signature-v4 headers: {'x-amz-content-sha256': '7b66bf58a169f2942abb1ad9ea6ac71fae86391d74748cf60be8b2fefba0d165', 'content-type': 'application/xml', 'Authorization': 'AWS4-HMAC-SHA256 Credential=AKIAJCORVRBCMMRL3ZAA/20160624/eu-west-1/s3/aws4_request,SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date,Signature=2efd897320017b1bc25a803580e128cb489e90b764b057a6e7c08e4ca5c753ac', 'x-amz-date': '20160624T150823Z'}
16:08:23 DEBUG: Processing request, please wait...
16:08:23 DEBUG: get_hostname(my-bucket): my-bucket.s3.amazonaws.com
16:08:23 DEBUG: ConnMan.get(): re-using connection: https://my-bucket.s3.amazonaws.com#32
16:08:23 DEBUG: format_uri(): /assets/css/component-presentation.min.css?acl
16:08:23 DEBUG: Sending request method_string='PUT', uri='/assets/css/component-presentation.min.css?acl', headers={'x-amz-content-sha256': '7b66bf58a169f2942abb1ad9ea6ac71fae86391d74748cf60be8b2fefba0d165', 'content-type': 'application/xml', 'Authorization': 'AWS4-HMAC-SHA256 Credential=AKIAJCORVRBCMMRL3ZAA/20160624/eu-west-1/s3/aws4_request,SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date,Signature=2efd897320017b1bc25a803580e128cb489e90b764b057a6e7c08e4ca5c753ac', 'x-amz-date': '20160624T150823Z'}, body=(441 bytes)
16:08:24 DEBUG: Response: {'status': 200, 'headers': {'x-amz-id-2': 'Xe2m+qHJj1GYToFkGygIVuF8UbkPhGyrA8y4achB6LbTQrD0Ruaepc4f4qnI9lV66lujdtE1nUM=', 'date': 'Fri, 24 Jun 2016 15:08:25 GMT', 'content-length': '0', 'x-amz-request-id': '0BF7BFC9F0C003A1', 'server': 'AmazonS3'}, 'reason': 'OK', 'data': ''}
16:08:24 DEBUG: ConnMan.put(): connection put back to pool (https://my-bucket.s3.amazonaws.com#33)
16:08:24 remote copy: 'assets/css/component-presentation-628d1185fb.min.css' -> 'assets/css/component-presentation.min.css'
Edit: Interestingly it seems to be the original file that gets changed, the copy seems to be ok?
Thanks, Adam
I had the same issue, I solved using @camallen solution: https://github.com/camallen/old-weather/commit/5f5e12564623d3de04e8e670d39f7910788e50f5
Thank you!
still a problem, workaround does not work for me any more with the latest s3 cmd:
Unknown options: --no-mime-magic,--guess-mime-type
@mdomsch just write a very basic css file, create a index.html including it and upload it to a bucket to reproduce
+1
S3tools uploaded my css file to the s3 bucket with the incorrect mime type.
Same error message as adamdodev above: "Resource interpreted as Stylesheet but transferred with MIME type text/plain: "
CSS won't load for Chrome / Firefox.
Safari still worked. Not sure about IE.
@adampblack Experiencing the same issue with 1.6.1. As suggested by @robertkowalski , the following params fix the issue:
--no-mime-magic --guess-mime-type
In my case, the CSS file having issues is minified, not sure if this is perhaps an issue with some library detecting the type?
passing --no-mime-magic --guess-mime-type on ubuntu does not solve the problem, I manually remove python3-magic to force s3cmd to guess the mime type. I am using sudo dpkg --remove --force-depends python3-magic to solve the issue