diff options
| author | Gaƫl Utard <gael.utard@eedf.fr> | 2025-02-15 15:55:33 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-02-17 14:06:03 +0100 |
| commit | a9d03c409406f3f95f692bc5545ebacc7f4e2e4f (patch) | |
| tree | 9746260f5fecfcc55555c0c934649ff2aedfacd5 /django/core/files/storage/filesystem.py | |
| parent | 20e965e869d657a3a24ddac6065ee494f283aa18 (diff) | |
[5.1.x] Fixed #36191 -- Truncated the overwritten file content in FileSystemStorage.
Backport of 0d1dd6bba0c18b7feb6caa5cbd8df80fbac54afd from main.
Diffstat (limited to 'django/core/files/storage/filesystem.py')
| -rw-r--r-- | django/core/files/storage/filesystem.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/files/storage/filesystem.py b/django/core/files/storage/filesystem.py index bf2b9caad4..1bd9aa0a6c 100644 --- a/django/core/files/storage/filesystem.py +++ b/django/core/files/storage/filesystem.py @@ -129,11 +129,11 @@ class FileSystemStorage(Storage, StorageSettingsMixin): ) # RemovedInDjango60Warning: when the deprecation ends, replace with: # if self._allow_overwrite: - # open_flags = open_flags & ~os.O_EXCL + # open_flags = open_flags & ~os.O_EXCL | os.O_TRUNC if self.OS_OPEN_FLAGS != open_flags: open_flags = self.OS_OPEN_FLAGS elif 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: |
