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

[bugfix] - Fix file deletion issue #115

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
11 changes: 9 additions & 2 deletions smbclientng/core/InteractiveShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,12 +862,19 @@ def command_rm(self, arguments, command):
# SMB share needed : Yes

for path_to_file in arguments:
# Wildcard
# Check if the path is absolute
# Fullpath is required to check if path is a file
if ntpath.isabs(path_to_file):
full_path = ntpath.normpath(path_to_file)
else:
# Relative path, construct full path
full_path = ntpath.normpath(ntpath.join(self.sessionsManager.current_session.smb_cwd, path_to_file))
# Wildcard handling
if '*' in path_to_file:
self.sessionsManager.current_session.rm(path=path_to_file)
# File
elif self.sessionsManager.current_session.path_exists(path_to_file):
if self.sessionsManager.current_session.path_isfile(path_to_file):
if self.sessionsManager.current_session.path_isfile(full_path):
try:
self.sessionsManager.current_session.rm(path=path_to_file)
except Exception as e:
Expand Down
Loading