summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-04-04 09:52:22 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-04-07 16:15:25 +0200
commit39b144baddca433b9aa28f99e595ffcc191c0bee (patch)
tree3d3fc31096afd8fb8efc68a97a1cf023cadc394b /django
parentbbf376bbc8cdfca817b54e7df99539633d10b06e (diff)
[5.1.x] Fixed #36298 -- Truncated the overwritten file content in file_move_safe().
Regression in 58cd4902a71a3695dd6c21dc957f59c333db364c. Thanks Baptiste Mispelon for the report. Backport of 8ad3e80e88201f4c557f6fa79fcfc0f8a0961830 from main.
Diffstat (limited to 'django')
-rw-r--r--django/core/files/move.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/django/core/files/move.py b/django/core/files/move.py
index d7a9c7026e..57508fab82 100644
--- a/django/core/files/move.py
+++ b/django/core/files/move.py
@@ -55,6 +55,7 @@ def file_move_safe(
| os.O_CREAT
| getattr(os, "O_BINARY", 0)
| (os.O_EXCL if not allow_overwrite else 0)
+ | os.O_TRUNC
),
)
try: