Skip to content

Commit 5be7b90

Browse files
authored
Merge pull request #30 from rootforbid/master
Enable folder deletions
2 parents fe9b30d + 0a2807c commit 5be7b90

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

BunnyCDN/Storage.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ def PutFile(
163163

164164
def DeleteFile(self, storage_path=""):
165165
"""
166-
This function deletes a file mentioned in the storage_path from the storage zone
166+
This function deletes a file or folder mentioned in the storage_path from the storage zone
167167
Parameters
168168
----------
169-
storage_path : The directory path to your file(including file name) which is to be deleted.
169+
storage_path : The directory path to your file (including file name) or folder which is to be deleted.
170170
If this is the root of your storage zone, you can ignore this parameter.
171171
"""
172172
# Add code below
@@ -176,8 +176,6 @@ def DeleteFile(self, storage_path=""):
176176
# to build correct url
177177
if storage_path[0] == "/":
178178
storage_path = storage_path[1:]
179-
if storage_path[-1] == "/":
180-
storage_path = storage_path[:-1]
181179
url = self.base_url + parse.quote(storage_path)
182180

183181
try:

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ Storage module has functions that utilize APIs mentioned in official Bunnycdn st
7575
The storage_path here does not include storage zone name and it should end with the desired file name to be stored in storage zone.(example: 'sample_dir/abc.txt')
7676
7777
The local_upload_file_path is the path of the file in the local PC excluding file name
78-
* ### Delete File
79-
To delete a file from a specific directory in storage zone
78+
* ### Delete File/Folder
79+
To delete a file or folder from a specific directory in storage zone
8080
```
8181
>>obj_storage.DeleteFile(storage_path)
8282
```
83+
If deleting a folder, make sure the storage_path ends with a trailing slash "/".
84+
Deleting a folder will delete all files within it.
8385
* ### Get Storaged Objects List
8486
Returns a list containing name of all the files and folders in the directory specified in storage path
8587
```
@@ -466,4 +468,4 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md
466468
467469
**For any bugs or issue mail**
468470
469-
471+

0 commit comments

Comments
 (0)