mirror of
https://github.com/google/adb-sync.git
synced 2026-01-04 02:18:01 +00:00
Fix path appending to not append /. or /.. components.
This commit is contained in:
10
adb-sync
10
adb-sync
@@ -587,6 +587,7 @@ def ExpandWildcards(globber, path):
|
|||||||
|
|
||||||
def FixPath(src, dst):
|
def FixPath(src, dst):
|
||||||
# rsync-like path munging to make remote specifications shorter.
|
# rsync-like path munging to make remote specifications shorter.
|
||||||
|
append = b''
|
||||||
pos = src.rfind(b'/')
|
pos = src.rfind(b'/')
|
||||||
if pos >= 0:
|
if pos >= 0:
|
||||||
if src.endswith(b'/'):
|
if src.endswith(b'/'):
|
||||||
@@ -594,9 +595,14 @@ def FixPath(src, dst):
|
|||||||
src = src[:-1]
|
src = src[:-1]
|
||||||
else:
|
else:
|
||||||
# No final slash: destination name == source name.
|
# No final slash: destination name == source name.
|
||||||
dst += src[pos:]
|
append = src[pos:]
|
||||||
else:
|
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)
|
return (src, dst)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user