1
0
mirror of https://github.com/django/django.git synced 2025-01-08 17:37:20 +00:00

Refs #35818 - Add a failing test to reproduce the bug

This commit is contained in:
Bruno Alla 2024-10-07 10:38:55 -03:00
parent 50f89ae850
commit 64ec5c4cef
No known key found for this signature in database

View File

@ -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")