From 64ec5c4cef8c8feeb32ef00c1ec8b9cf2b717fc5 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 7 Oct 2024 10:38:55 -0300 Subject: [PATCH] Refs #35818 - Add a failing test to reproduce the bug --- tests/file_storage/tests.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py index 5f0024b81a..3ebeee22c1 100644 --- a/tests/file_storage/tests.py +++ b/tests/file_storage/tests.py @@ -738,6 +738,14 @@ class OverwritingStorageTests(FileStorageTests): self.assertEqual(stored_name, "test_l.txt") self.assertEqual(len(stored_name), 10) + def test_file_name_truncation_with_dotted_name(self): + name = "test.long.dotted.name.txt" + file = ContentFile(b"content") + stored_name = self.storage.save(name, file, max_length=10) + self.addCleanup(self.storage.delete, stored_name) + self.assertEqual(stored_name, "test.l.txt") + self.assertEqual(len(stored_name), 10) + def test_file_name_truncation_extension_too_long(self): name = "file_name.longext" file = ContentFile(b"content")