Option --mime-type now has a different meaning - from now on
it forces setting the given MIME type instead of setting a default
MIME type. For changing the default from binary/octet-stream use
a new option --default-mime-type.
Also --guess-mime-type is no longer on by default and if set to true
in the config file can be turned back off with --no-guess-mime-type
... | ... |
@@ -4,6 +4,8 @@ s3cmd 1.1.0 - ??? |
4 | 4 |
* Increased socket_timeout from 10 secs to 5 mins. |
5 | 5 |
* Added "Static WebSite" support [ws-create / ws-delete / ws-info] |
6 | 6 |
(contributed by Jens Braeuer) |
7 |
+* Force MIME type with --mime-type=abc/xyz, also --guess-mime-type |
|
8 |
+ is no longer on by default. |
|
7 | 9 |
|
8 | 10 |
s3cmd 1.0.0 - 2011-01-18 |
9 | 11 |
=========== |
... | ... |
@@ -60,7 +60,8 @@ class Config(object): |
60 | 60 |
use_https = False |
61 | 61 |
bucket_location = "US" |
62 | 62 |
default_mime_type = "binary/octet-stream" |
63 |
- guess_mime_type = True |
|
63 |
+ guess_mime_type = False |
|
64 |
+ mime_type = "" |
|
64 | 65 |
# List of checks to be performed for 'sync' |
65 | 66 |
sync_checks = ['size', 'md5'] # 'weak-timestamp' |
66 | 67 |
# List of compiled REGEXPs |
... | ... |
@@ -326,8 +326,8 @@ class S3(object): |
326 | 326 |
if extra_headers: |
327 | 327 |
headers.update(extra_headers) |
328 | 328 |
headers["content-length"] = size |
329 |
- content_type = None |
|
330 |
- if self.config.guess_mime_type: |
|
329 |
+ content_type = self.config.mime_type |
|
330 |
+ if not content_type and self.config.guess_mime_type: |
|
331 | 331 |
content_type = mimetypes.guess_type(filename)[0] |
332 | 332 |
if not content_type: |
333 | 333 |
content_type = self.config.default_mime_type |
... | ... |
@@ -1497,8 +1497,10 @@ def main(): |
1497 | 1497 |
optparser.add_option( "--access-logging-target-prefix", dest="log_target_prefix", help="Target prefix for access logs (S3 URI) (for [cfmodify] and [accesslog] commands)") |
1498 | 1498 |
optparser.add_option( "--no-access-logging", dest="log_target_prefix", action="store_false", help="Disable access logging (for [cfmodify] and [accesslog] commands)") |
1499 | 1499 |
|
1500 |
- optparser.add_option("-m", "--mime-type", dest="default_mime_type", type="mimetype", metavar="MIME/TYPE", help="Default MIME-type to be set for objects stored.") |
|
1501 |
- optparser.add_option("-M", "--guess-mime-type", dest="guess_mime_type", action="store_true", help="Guess MIME-type of files by their extension. Falls back to default MIME-Type as specified by --mime-type option") |
|
1500 |
+ optparser.add_option( "--default-mime-type", dest="default_mime_type", action="store_true", help="Default MIME-type for stored objects. Application default is binary/octet-stream.") |
|
1501 |
+ optparser.add_option("-M", "--guess-mime-type", dest="guess_mime_type", action="store_true", help="Guess MIME-type of files by their extension. Fall back to default MIME-Type as specified by --default-mime-type option") |
|
1502 |
+ optparser.add_option( "--no-guess-mime-type", dest="guess_mime_type", action="store_false", help="Don't guess MIME-type and use the default type instead.") |
|
1503 |
+ optparser.add_option("-m", "--mime-type", dest="mime_type", type="mimetype", metavar="MIME/TYPE", help="Force MIME-type. Override both --default-mime-type and --guess-mime-type.") |
|
1502 | 1504 |
|
1503 | 1505 |
optparser.add_option( "--add-header", dest="add_header", action="append", metavar="NAME:VALUE", help="Add a given HTTP header to the upload request. Can be used multiple times. For instance set 'Expires' or 'Cache-Control' headers (or both) using this options if you like.") |
1504 | 1506 |
|