git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@444 830e0280-6d2a-0410-9c65-932aecc39d9d
Michal Ludvig authored on 2010/10/25 16:49:42... | ... |
@@ -1,5 +1,10 @@ |
1 | 1 |
2010-10-25 Michal Ludvig <mludvig@logix.net.nz> |
2 | 2 |
|
3 |
+ * s3cmd: Improved 'fixbucket' command. Thanks to Srinivasa |
|
4 |
+ Moorthy. |
|
5 |
+ |
|
6 |
+2010-10-25 Michal Ludvig <mludvig@logix.net.nz> |
|
7 |
+ |
|
3 | 8 |
* s3cmd: Don't fail when a local node is a directory |
4 | 9 |
and we expected a file. (as if for example /etc/passwd |
5 | 10 |
was a dir) |
... | ... |
@@ -1258,6 +1258,7 @@ def cmd_fixbucket(args): |
1258 | 1258 |
except KeyError: |
1259 | 1259 |
pass |
1260 | 1260 |
return text # leave as is |
1261 |
+ text = text.encode('ascii', 'xmlcharrefreplace') |
|
1261 | 1262 |
return re.sub("&#?\w+;", _unescape_fixup, text) |
1262 | 1263 |
|
1263 | 1264 |
cfg.urlencoding_mode = "fixbucket" |
... | ... |
@@ -1270,6 +1271,7 @@ def cmd_fixbucket(args): |
1270 | 1270 |
raise ParameterError("Expecting S3Uri instead of: %s" % arg) |
1271 | 1271 |
response = s3.bucket_list_noparse(culprit.bucket(), culprit.object(), recursive = True) |
1272 | 1272 |
r_xent = re.compile("&#x[\da-fA-F]+;") |
1273 |
+ response['data'] = unicode(response['data'], 'UTF-8') |
|
1273 | 1274 |
keys = re.findall("<Key>(.*?)</Key>", response['data'], re.MULTILINE) |
1274 | 1275 |
debug("Keys: %r" % keys) |
1275 | 1276 |
for key in keys: |