Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding -T flag for non-strict file path checking to scp get #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def putfo(self, fl, remote_path, mode='0644', size=None):
self.close()

def get(self, remote_path, local_path='',
recursive=False, preserve_times=False):
# type: (PathTypes, Union[str, bytes], bool, bool) -> None
recursive=False, preserve_times=False, strict_file_names=False):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it really be enabled by default?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it shouldn't, my mistake.

# type: (PathTypes, Union[str, bytes], bool, bool, bool) -> None
"""
Transfer files and directories from remote host to localhost.

Expand Down Expand Up @@ -270,12 +270,14 @@ def get(self, remote_path, local_path='',
asunicode(self._recv_dir))
rcsv = (b'', b' -r')[recursive]
prsv = (b'', b' -p')[preserve_times]
trsv = (b'', b' -T')[not strict_file_names]
self.channel = self._open()
self._pushed = 0
self.channel.settimeout(self.socket_timeout)
self.channel.exec_command(self.scp_command +
rcsv +
prsv +
trsv +
b" -f " +
b' '.join(remote_path))
self._recv_all()
Expand Down