Skip to content

Commit

Permalink
feat: Allow to terminate upload link
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlospaco committed Sep 11, 2024
1 parent a041bd4 commit 60d5f87
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions storage3/_sync/resumable.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@ def resumable_offset(self, link, headers) -> str:
response = self._client.head(link, headers=headers)
return response.headers["upload-offset"]

def terminate(self, file: str) -> None:
"""Drop the link associated with a file
Parameters
----------
file
file name used to get its metadata info
"""
info = self._filestore.get_file_info(file)
response = self._client.delete(info["link"], headers=info["headers"])

if response.status_code != 204:
raise StorageException(response.content)

def upload(
self, filename, upload_defer=False, link=None, objectname=None, mb_size=1
) -> None:
Expand Down

0 comments on commit 60d5f87

Please sign in to comment.