Revision 8dbf5a1a
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
1109 | 1109 |
for f in files: |
1110 | 1110 |
fpath = path.join(top, f) |
1111 | 1111 |
if path.isfile(fpath): |
1112 |
yield open(fpath, 'rb'), '%s/%s' % (rel_path, f) |
|
1112 |
rel_path = rel_path.replace(path.sep, '/') |
|
1113 |
pathfix = f.replace(path.sep, '/') |
|
1114 |
yield open(fpath, 'rb'), '%s/%s' % (rel_path, pathfix) |
|
1113 | 1115 |
else: |
1114 | 1116 |
print('%s is not a regular file' % fpath) |
1115 | 1117 |
else: |
... | ... | |
1118 | 1120 |
try: |
1119 | 1121 |
robj = self.client.get_object_info(rpath) |
1120 | 1122 |
if remote_path and self._is_dir(robj): |
1121 |
rpath += '/%s' % short_path
|
|
1123 |
rpath += '/%s' % (short_path.replace(path.sep, '/'))
|
|
1122 | 1124 |
self.client.get_object_info(rpath) |
1123 | 1125 |
if not self['overwrite']: |
1124 | 1126 |
raiseCLIError( |
... | ... | |
1305 | 1307 |
raiseCLIError( |
1306 | 1308 |
'Illegal download: Remote object %s is a directory' % ( |
1307 | 1309 |
self.path), |
1308 |
details=['To download a directory, try --recursive']) |
|
1310 |
details=['To download a directory, try --recursive or -R'])
|
|
1309 | 1311 |
if '/' in self.path.strip('/') and not local_path: |
1310 | 1312 |
raiseCLIError( |
1311 | 1313 |
'Illegal download: remote object %s contains "/"' % ( |
... | ... | |
1319 | 1321 |
if self.path: |
1320 | 1322 |
raiseCLIError( |
1321 | 1323 |
'No matching path %s on container %s' % ( |
1322 |
self.path, |
|
1323 |
self.container), |
|
1324 |
self.path, self.container), |
|
1324 | 1325 |
details=[ |
1325 | 1326 |
'To list the contents of %s, try:' % self.container, |
1326 | 1327 |
' /file list %s' % self.container]) |
... | ... | |
1333 | 1334 |
lprefix = path.abspath(local_path or path.curdir) |
1334 | 1335 |
if path.isdir(lprefix): |
1335 | 1336 |
for rpath, remote_is_dir in remotes: |
1336 |
lpath = '/%s/%s' % (lprefix.strip('/'), rpath.strip('/')) |
|
1337 |
lpath = path.sep.join([ |
|
1338 |
lprefix[:-1] if lprefix.endswith(path.sep) else lprefix, |
|
1339 |
rpath.strip('/').replace('/', path.sep)]) |
|
1337 | 1340 |
if remote_is_dir: |
1338 | 1341 |
if path.exists(lpath) and path.isdir(lpath): |
1339 | 1342 |
continue |
Also available in: Unified diff