Skip to content

Commit

Permalink
Fix bug in handling of subdirectories in remote_file_size #2168 (#3199)
Browse files Browse the repository at this point in the history
Co-authored-by: Lars Erik Dystland <lars.erik.dystland@kongsbergdigital.com>
  • Loading branch information
dystland and Lars Erik Dystland authored Jun 9, 2023
1 parent 9b5137f commit 0107c79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion netmiko/scp_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ def remote_file_size(
remote_out = "".join(remote_out_lines)
# Match line containing file name
assert isinstance(remote_file, str)
escape_file_name = re.escape(remote_file)
remote_file_base = os.path.basename(remote_file)
escape_file_name = re.escape(remote_file_base)
pattern = r".*({}).*".format(escape_file_name)
match = re.search(pattern, remote_out)
if match:
Expand Down

0 comments on commit 0107c79

Please sign in to comment.