Use fid_abs prefix for absolute symlinks

This commit is contained in:
Kovid Goyal 2021-11-24 08:41:16 +05:30
parent a62e831932
commit e5de16bb01
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -209,7 +209,8 @@ def files_for_send(cli_opts: TransferCLIOptions, args: List[str]) -> Tuple[File,
files.remove(f)
continue
f.symbolic_link_target = f'path:{link_dest}'
q = link_dest if os.path.isabs(link_dest) else os.path.join(os.path.dirname(f.local_path), link_dest)
is_abs = os.path.isabs(link_dest)
q = link_dest if is_abs else os.path.join(os.path.dirname(f.local_path), link_dest)
try:
st = os.stat(q)
except OSError:
@ -220,7 +221,8 @@ def files_for_send(cli_opts: TransferCLIOptions, args: List[str]) -> Tuple[File,
g = tuple(x for x in groups[fh] if os.path.samestat(st, x.stat_result))
if g:
t = g[0]
f.symbolic_link_target = f'fid:{t.file_id}'
prefix = 'fid_abs' if is_abs else 'fid'
f.symbolic_link_target = f'{prefix}:{t.file_id}'
return tuple(files)