Skip to content

Commit

Permalink
Implemented an override for Storage.get_available_name to respect _RE…
Browse files Browse the repository at this point in the history
…PLACE_EXISTING
  • Loading branch information
theriverman committed Dec 12, 2020
1 parent 14d85d4 commit 01c37bc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions django_minio_backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ def _save(self, file_path_name: str, content: InMemoryUploadedFile) -> str:
)
return file_path.as_posix()

def get_available_name(self, name, max_length=None):
"""
Return a filename that's free on the target storage system and
available for new content to be written to.
"""
if self._REPLACE_EXISTING:
return name
return super(MinioBackend, self).get_available_name(name, max_length)

def _open(self, object_name, mode='rb', **kwargs):
"""
Implements the Storage._open(name,mode='rb') method
Expand Down

0 comments on commit 01c37bc

Please sign in to comment.