Fix rel path logic when transferring symlinks
This commit is contained in:
parent
d9f4fadf2d
commit
8e8a0d2df6
@ -201,17 +201,9 @@ class Manager:
|
|||||||
target = rid_map.get(f.remote_target)
|
target = rid_map.get(f.remote_target)
|
||||||
if target is None:
|
if target is None:
|
||||||
return f'Symbolic link with remote id: {f.remote_target} not found'
|
return f'Symbolic link with remote id: {f.remote_target} not found'
|
||||||
if f.remote_symlink_value.startswith(b'/'):
|
|
||||||
lt = target.expanded_local_path
|
lt = target.expanded_local_path
|
||||||
else:
|
if not f.remote_symlink_value.startswith(b'/'):
|
||||||
lt = target.expanded_local_path
|
lt = os.path.relpath(lt, os.path.dirname(f.expanded_local_path))
|
||||||
try:
|
|
||||||
cp = os.path.commonpath((f.expanded_local_path, lt))
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if cp:
|
|
||||||
lt = os.path.relpath(lt, cp)
|
|
||||||
else:
|
else:
|
||||||
lt = f.remote_symlink_value.decode('utf-8')
|
lt = f.remote_symlink_value.decode('utf-8')
|
||||||
os.symlink(lt, f.expanded_local_path)
|
os.symlink(lt, f.expanded_local_path)
|
||||||
|
|||||||
@ -429,13 +429,7 @@ class DestFile:
|
|||||||
if lt.startswith('fid:'):
|
if lt.startswith('fid:'):
|
||||||
lt = all_files[lt[4:]].name
|
lt = all_files[lt[4:]].name
|
||||||
if self.ftype is FileType.symlink:
|
if self.ftype is FileType.symlink:
|
||||||
try:
|
lt = os.path.relpath(lt, os.path.dirname(self.name))
|
||||||
cp = os.path.commonpath((self.name, lt))
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if cp:
|
|
||||||
lt = os.path.relpath(lt, cp)
|
|
||||||
elif lt.startswith('fid_abs:'):
|
elif lt.startswith('fid_abs:'):
|
||||||
lt = all_files[lt[8:]].name
|
lt = all_files[lt[8:]].name
|
||||||
elif lt.startswith('path:'):
|
elif lt.startswith('path:'):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user