git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@384 830e0280-6d2a-0410-9c65-932aecc39d9d
Michal Ludvig authored on 2009/03/03 20:01:17... | ... |
@@ -267,6 +267,11 @@ class S3(object): |
267 | 267 |
def urlencode_string(self, string): |
268 | 268 |
if type(string) == unicode: |
269 | 269 |
string = string.encode("utf-8") |
270 |
+ |
|
271 |
+ if self.config.verbatim: |
|
272 |
+ ## Don't do any pre-processing |
|
273 |
+ return string |
|
274 |
+ |
|
270 | 275 |
encoded = "" |
271 | 276 |
## List of characters that must be escaped for S3 |
272 | 277 |
## Haven't found this in any official docs |
... | ... |
@@ -287,6 +292,7 @@ class S3(object): |
287 | 287 |
o == 0x22 or # " |
288 | 288 |
o == 0x23 or # # |
289 | 289 |
o == 0x25 or # % |
290 |
+ o == 0x26 or # & |
|
290 | 291 |
o == 0x2B or # + (or it would become <space>) |
291 | 292 |
o == 0x3C or # < |
292 | 293 |
o == 0x3E or # > |
... | ... |
@@ -1389,6 +1389,7 @@ def main(): |
1389 | 1389 |
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.") |
1390 | 1390 |
|
1391 | 1391 |
optparser.add_option( "--encoding", dest="encoding", metavar="ENCODING", help="Override autodetected terminal and filesystem encoding (character set). Autodetected: %s" % preferred_encoding) |
1392 |
+ optparser.add_option( "--verbatim", dest="verbatim", action="store_true", help="Use the S3 name as given on the command line. No pre-processing, encoding, etc. Use with caution!") |
|
1392 | 1393 |
|
1393 | 1394 |
optparser.add_option( "--list-md5", dest="list_md5", action="store_true", help="Include MD5 sums in bucket listings (only for 'ls' command).") |
1394 | 1395 |
optparser.add_option("-H", "--human-readable-sizes", dest="human_readable_sizes", action="store_true", help="Print sizes in human readable form (eg 1kB instead of 1234).") |