Skip to content

Commit

Permalink
πŸ› FIX: listdir method with pattern for SSH (#5252)
Browse files Browse the repository at this point in the history
The `listdir` method of the SSH transport plugin was using
`glob.glob` instead of `self.glob` when a pattern was specified.
This is wrong because it's listing files locally and not on the
remote.
The tests passed because they are running on localhost.
Also, this method is probably never called by AiiDA so it went unnoticed.
  • Loading branch information
giovannipizzi authored Dec 7, 2021
1 parent 294fa68 commit 1890bab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aiida/transports/plugins/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ def listdir(self, path='.', pattern=None):
else:
base_dir = os.path.join(self.getcwd(), path)

filtered_list = glob.glob(os.path.join(base_dir, pattern))
filtered_list = self.glob(os.path.join(base_dir, pattern))
if not base_dir.endswith('/'):
base_dir += '/'
return [re.sub(base_dir, '', i) for i in filtered_list]
Expand Down

0 comments on commit 1890bab

Please sign in to comment.