summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorGaƫl Utard <gael.utard@eedf.fr>2025-02-15 15:55:33 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-02-17 14:01:00 +0100
commit0d1dd6bba0c18b7feb6caa5cbd8df80fbac54afd (patch)
tree2105176ab2903fe8a7dfc5cef82d8340f2f96c89 /django
parent2fa1f99ab49ae5b6bc0a15ed9398d6fa2996f02a (diff)
Fixed #36191 -- Truncated the overwritten file content in FileSystemStorage.
Diffstat (limited to 'django')
-rw-r--r--django/core/files/storage/filesystem.py2
1 files changed, 1 insertions, 1 deletions
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: