s3tools / s3cmd

Official s3cmd repo -- Command line tool for managing S3 compatible storage services (including Amazon S3 and CloudFront).

Home Page:https://s3tools.org/s3cmd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setcors on file puts file

StefanBrand opened this issue · comments

I mistakenly used setcors on a file. It seems to silently overwrite the file.

Steps to reproduce

$ echo '<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>DELETE</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>
' >  cors_config.xml
$ s3cmd setcors cors_config.xml s3://test-bucket/test.txt
$ s3cmd get s3://stefans-bucket/test.txt -
download: 's3://stefans-bucket/test.txt' -> '-'  [1 of 1]
 378 of 378   100% in    0s  1381.92 B/s<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>DELETE</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>
 378 of 378   100% in    0s  1378.01 B/s  done