summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/core/files/storage/base.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/files/storage/base.py b/django/core/files/storage/base.py
index 16ac22f70a..6ce4ab2535 100644
--- a/django/core/files/storage/base.py
+++ b/django/core/files/storage/base.py
@@ -69,7 +69,8 @@ class Storage:
"Detected path traversal attempt in '%s'" % dir_name
)
validate_file_name(file_name)
- file_root, file_ext = os.path.splitext(file_name)
+ file_ext = "".join(pathlib.PurePath(file_name).suffixes)
+ file_root = file_name.removesuffix(file_ext)
# If the filename already exists, generate an alternative filename
# until it doesn't exist.
# Truncate original name if required, so the new filename does not