From 0d1dd6bba0c18b7feb6caa5cbd8df80fbac54afd Mon Sep 17 00:00:00 2001 From: Gaƫl Utard Date: Sat, 15 Feb 2025 15:55:33 +0100 Subject: Fixed #36191 -- Truncated the overwritten file content in FileSystemStorage. --- django/core/files/storage/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django') diff --git a/django/core/files/storage/filesystem.py b/django/core/files/storage/filesystem.py index b8de9b0a58..54c31e536a 100644 --- a/django/core/files/storage/filesystem.py +++ b/django/core/files/storage/filesystem.py @@ -113,7 +113,7 @@ class FileSystemStorage(Storage, StorageSettingsMixin): | getattr(os, "O_BINARY", 0) ) if self._allow_overwrite: - open_flags = open_flags & ~os.O_EXCL + open_flags = open_flags & ~os.O_EXCL | os.O_TRUNC fd = os.open(full_path, open_flags, 0o666) _file = None try: -- cgit v1.3