From b55f9d91cee29ffa5e89abc7638a453a0d453b5b Mon Sep 17 00:00:00 2001 From: Pixis Date: Mon, 3 Jun 2024 10:50:15 +0200 Subject: [PATCH] Update SMBSession.py to fix https://github.com/p0dalirius/smbclient-ng/issues/3 Fix https://github.com/p0dalirius/smbclient-ng/issues/3 --- smbclientng/core/SMBSession.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/smbclientng/core/SMBSession.py b/smbclientng/core/SMBSession.py index c52075e..5004d90 100644 --- a/smbclientng/core/SMBSession.py +++ b/smbclientng/core/SMBSession.py @@ -443,9 +443,11 @@ def list_contents(self, path=None): dict: A dictionary with file and directory names as keys and their SMB entry objects as values. """ - if path is None or len(path) == 0: - path = self.smb_cwd - path = path.rstrip(ntpath.sep) + ntpath.sep + "*" + dest_path = [self.smb_cwd.rstrip(ntpath.sep),] + if path is not None and len(path) > 0: + dest_path.append(path.rstrip(ntpath.sep)) + dest_path.append('*') + path = ntpath.sep.join(dest_path) contents = {} entries = self.smbClient.listPath(