1
0
mirror of https://github.com/google/adb-sync.git synced 2026-01-03 09:58:01 +00:00

Fix path appending to not append /. or /.. components.

This commit is contained in:
Rudolf Polzer
2014-09-10 12:01:20 +02:00
parent fe9d9f1584
commit 95b7746cba

View File

@@ -587,6 +587,7 @@ def ExpandWildcards(globber, path):
def FixPath(src, dst):
# rsync-like path munging to make remote specifications shorter.
append = b''
pos = src.rfind(b'/')
if pos >= 0:
if src.endswith(b'/'):
@@ -594,9 +595,14 @@ def FixPath(src, dst):
src = src[:-1]
else:
# No final slash: destination name == source name.
dst += src[pos:]
append = src[pos:]
else:
dst += b'/' + src
# No slash at all - use same name at destination.
append = b'/' + src
# Append the destination file name if any.
# BUT: do not append "." or ".." components!
if append != b'/.' and append != b'/..':
dst += append
return (src, dst)