... | ... |
@@ -412,7 +412,7 @@ class S3(object): |
412 | 412 |
content_type = self.config.mime_type |
413 | 413 |
content_encoding = None |
414 | 414 |
if filename != "-" and not content_type and self.config.guess_mime_type: |
415 |
- (content_type, content_encoding) = mime_magic(filename) |
|
415 |
+ (content_type, content_encoding) = mime_magic(filename) if self.config.use_mime_magic else mimetypes.guess_type(filename) |
|
416 | 416 |
if not content_type: |
417 | 417 |
content_type = self.config.default_mime_type |
418 | 418 |
|
... | ... |
@@ -1945,6 +1945,7 @@ def main(): |
1945 | 1945 |
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.") |
1946 | 1946 |
optparser.add_option("-M", "--guess-mime-type", dest="guess_mime_type", action="store_true", help="Guess MIME-type of files by their extension or mime magic. Fall back to default MIME-Type as specified by --default-mime-type option") |
1947 | 1947 |
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.") |
1948 |
+ optparser.add_option( "--no-mime-magic", dest="use_mime_magic", action="store_false", help="Don't use mime magic when guessing MIME-type.") |
|
1948 | 1949 |
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.") |
1949 | 1950 |
|
1950 | 1951 |
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.") |
... | ... |
@@ -253,6 +253,9 @@ Guess MIME-type of files by their extension or mime magic. Fall back to default |
253 | 253 |
\fB\-\-no\-guess\-mime\-type\fR |
254 | 254 |
Don't guess MIME-type and use the default type instead. |
255 | 255 |
.TP |
256 |
+\fB\-\-no\-mime\-magic\fR |
|
257 |
+Don't use mime magic when guessing MIME-type. |
|
258 |
+.TP |
|
256 | 259 |
\fB\-m\fR MIME/TYPE, \fB\-\-mime\-type\fR=MIME/TYPE |
257 | 260 |
Force MIME-type. Override both \fB\-\-default\-mime\-type\fR and \fB\-\-guess\-mime\-type\fR. |
258 | 261 |
.TP |