Skip to content

Commit

Permalink
Fix an issue in the SCP server related to handling files with spaces
Browse files Browse the repository at this point in the history
This commit fixes a problem handling filenames with spaces in the SCP
server code. Thanks go out to Stephen Copeland for reporting the issue
and suggesting a fix!

This also includes a fix for an issue related to handling of filenames
with colons in them passed as byte strings. This issue was previously
fixed when passing in regular strings, but the byte string case was
missed.
  • Loading branch information
ronf committed Feb 14, 2020
1 parent c40feba commit c992ec4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions asyncssh/scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _parse_cd_args(args):
"""Parse arguments to an SCP copy or dir request"""

try:
permissions, size, name = args.split()
permissions, size, name = args.split(None, 2)
return int(permissions, 8), int(size), name
except ValueError:
raise SCPError(FX_BAD_MESSAGE, 'Invalid copy or dir request') from None
Expand Down Expand Up @@ -74,7 +74,7 @@ async def _parse_path(path, **kwargs):
elif isinstance(path, str) and ':' in path:
conn, path = path.split(':', 1)
elif isinstance(path, bytes) and b':' in path:
conn, path = path.split(b':')
conn, path = path.split(b':', 1)
elif isinstance(path, (str, bytes, PurePath)):
conn = None
else:
Expand Down

0 comments on commit c992ec4

Please sign in to comment.