Revision 14d15eca
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
1104 | 1104 |
for f in files: |
1105 | 1105 |
fpath = path.join(top, f) |
1106 | 1106 |
if path.isfile(fpath): |
1107 |
yield open(fpath, 'rb'), '%s/%s' % (rel_path, f) |
|
1107 |
rel_path = rel_path.replace(path.sep, '/') |
|
1108 |
pathfix = f.replace(path.sep, '/') |
|
1109 |
yield open(fpath, 'rb'), '%s/%s' % (rel_path, pathfix) |
|
1108 | 1110 |
else: |
1109 | 1111 |
print('%s is not a regular file' % fpath) |
1110 | 1112 |
else: |
... | ... | |
1113 | 1115 |
try: |
1114 | 1116 |
robj = self.client.get_object_info(rpath) |
1115 | 1117 |
if remote_path and self._is_dir(robj): |
1116 |
rpath += '/%s' % short_path
|
|
1118 |
rpath += '/%s' % (short_path.replace(path.sep, '/'))
|
|
1117 | 1119 |
self.client.get_object_info(rpath) |
1118 | 1120 |
if not self['overwrite']: |
1119 | 1121 |
raiseCLIError( |
... | ... | |
1300 | 1302 |
raiseCLIError( |
1301 | 1303 |
'Illegal download: Remote object %s is a directory' % ( |
1302 | 1304 |
self.path), |
1303 |
details=['To download a directory, try --recursive']) |
|
1305 |
details=['To download a directory, try --recursive or -R'])
|
|
1304 | 1306 |
if '/' in self.path.strip('/') and not local_path: |
1305 | 1307 |
raiseCLIError( |
1306 | 1308 |
'Illegal download: remote object %s contains "/"' % ( |
... | ... | |
1314 | 1316 |
if self.path: |
1315 | 1317 |
raiseCLIError( |
1316 | 1318 |
'No matching path %s on container %s' % ( |
1317 |
self.path, |
|
1318 |
self.container), |
|
1319 |
self.path, self.container), |
|
1319 | 1320 |
details=[ |
1320 | 1321 |
'To list the contents of %s, try:' % self.container, |
1321 | 1322 |
' /file list %s' % self.container]) |
... | ... | |
1328 | 1329 |
lprefix = path.abspath(local_path or path.curdir) |
1329 | 1330 |
if path.isdir(lprefix): |
1330 | 1331 |
for rpath, remote_is_dir in remotes: |
1331 |
lpath = '/%s/%s' % (lprefix.strip('/'), rpath.strip('/')) |
|
1332 |
lpath = path.sep.join([ |
|
1333 |
lprefix[:-1] if lprefix.endswith(path.sep) else lprefix, |
|
1334 |
rpath.strip('/').replace('/', path.sep)]) |
|
1332 | 1335 |
if remote_is_dir: |
1333 | 1336 |
if path.exists(lpath) and path.isdir(lpath): |
1334 | 1337 |
continue |
Also available in: Unified diff