From 01b4409faf7825c2073692054669125ebd3563d1 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Tue, 28 Jan 2025 10:27:44 +0100 Subject: [PATCH] Use storage APIs in OverwriteStorage --- froide/helper/storage.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/froide/helper/storage.py b/froide/helper/storage.py index 8edbbc356..74f06c6a2 100644 --- a/froide/helper/storage.py +++ b/froide/helper/storage.py @@ -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