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

Use storage APIs in OverwriteStorage #944

Merged
merged 1 commit into from
Jan 28, 2025
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
5 changes: 2 additions & 3 deletions froide/helper/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ def sha256(file):


class OverwriteStorage(FileSystemStorage):
# TODO: Remove in Django 5.1 in favour of allow_overwrite option
def get_available_name(self, name, max_length=None):
# FIXME: max_length is ignored
# If the filename already exists, remove it as if it was a true file system
if self.exists(name):
full_path = self.path(name)
os.remove(full_path)
self.delete(name)
return name


Expand Down
Loading