-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Reading the tests, this seems to be by design but the docstring in the method says the contrary which is aligned with Path.rmdir's behavior.
s3path/s3path/current_version.py
Lines 339 to 350 in cbc37d5
| def rmdir(self): | |
| """ | |
| Removes this Bucket / key prefix. The Bucket / key prefix must be empty | |
| """ | |
| self._absolute_path_validation() | |
| if self.is_file(): | |
| raise NotADirectoryError() | |
| if not self.is_dir(): | |
| raise FileNotFoundError() | |
| accessor.rmdir(self) | |
This might cause unintended deletion of existing files
Still the current behavior can be quite helpful in lots of cases and I wonder if maybe we could either add some kind of force: bool parameter to the function or creating a rmtree function akin to shutil.rmtree to ensure no mistakes are made and keep this great bit of functionnality
I'm available for contributions if any these changes were to be approved
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels