summaryrefslogtreecommitdiff
path: root/tests/file_storage
AgeCommit message (Collapse)Author
2025-11-26Closed temporary files in ↵Jacob Walls
OverwritingStorageTests.test_save_overwrite_behavior_temp_file().
2025-10-15Fixed 36622 -- Prevented LazyObject FileField storages from evaluating at ↵Clifford Gama
boot time. Co-authored-by: Fabien MICHEL <fmichel@adista.fr>
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-05-23Fixed flakiness in ↵Nick Pope
file_storage.tests.CustomStorageTests.test_file_get_accessed_time. Two separate calls to look up access time can result in sub-second differences which cause the test to fail. Also made the equivalent tests for ctime and mtime have the same changes to ensure that they won't flake in the same way in future.
2025-02-18Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.Mariusz Felisiak
datetime.UTC was added in Python 3.11.
2025-02-17Fixed #36191 -- Truncated the overwritten file content in FileSystemStorage.Gaël Utard
2025-01-15Refs #35326 -- Removed FileSystemStorage.OS_OPEN_FLAGS per deprecation timeline.Sarah Boyce
2025-01-03Fixed #35740 -- Fixed FileFieldStorageTests.test_extended_length_storage ↵YashRaj1506
when using bcachefs. PC_NAME_MAX on bcachefs is 512, which was greater than the file field max_length.
2024-08-28Refs #35326 -- Adjusted deprecation warning stacklevel in ↵Simon Charette
FileSystemStorage.OS_OPEN_FLAGS.
2024-08-15Refs #35658 -- Fixed ↵Mariusz Felisiak
test_create_file_field_from_another_file_field_in_memory_storage when run in reverse.
2024-08-09Fixed #35658 -- Initialized InMemoryFileNode instances with a name.lucasesposito
2024-08-05Fixed #35657 -- Made FileField handle db_default values.Sarah Boyce
2024-07-24Fixed #35604, Refs #35326 -- Made FileSystemStorage.exists() behaviour ↵Sarah Boyce
independent from allow_overwrite. Partially reverts 0b33a3abc2ca7d68a24f6d0772bc2b9fa603744e. Storage.exists(name) was documented to "return False if the name is available for a new file." but return True if the file exists. This is ambiguous in the overwrite file case. It will now always return whether the file exists. Thank you to Natalia Bidart and Josh Schneier for the review.
2024-07-09Fixed CVE-2024-39330 -- Added extra file name validation in Storage's save ↵Natalia
method. Thanks to Josh Schneier for the report, and to Carlton Gibson and Sarah Boyce for the reviews.
2024-05-21Fixed #35326 -- Added allow_overwrite parameter to FileSystemStorage.Ben Cail
2024-05-10Added tests for Storage's generate_filename method.nessita
2024-02-20Fixed #23759 -- Preserved all file extensions in Storage.get_available_name().Adam Zapletal
2023-12-31Used addCleanup() in tests where appropriate.Mariusz Felisiak
2023-09-18Refs #26029 -- Removed DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings.Mariusz Felisiak
This also removes django.core.files.storage.get_storage_class(). Per deprecation timeline.
2023-08-22Removed unnecessary trailing commas in tests.konsti
2023-03-20Fixed some typos in comments, docstrings, and tests.Liyang Zhang
2023-01-23Fixed #34192 -- Preserved callable storage when it returns default_storage.Matt Westcott
2023-01-12Refs #26029 -- Deprecated DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings.Jarosław Wygoda
2023-01-12Fixed #26029 -- Allowed configuring custom file storage backends.Jarosław Wygoda
2023-01-10Fixed #34110 -- Added in-memory file storage.Francesco Panico
Thanks Paolo Melchiorre, Carlton Gibson, and Mariusz Felisiak for reviews.
2022-11-11Refs #34110 -- Reorganized django.core.files.storage into a separate module.Francesco Panico
2022-03-24Refs #32365 -- Removed internal uses of utils.timezone.utc alias.Carlton Gibson
Remaining test case ensures that uses of the alias are mapped canonically by the migration writer.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-01-04Fixed CVE-2021-45452 -- Fixed potential path traversal in storage subsystem.Florian Apolloner
Thanks to Dennis Brinkrolf for the report.
2021-07-29Fixed 32956 -- Lowercased spelling of "web" and "web framework" where ↵David Smith
appropriate.
2021-06-02Fixed #28154 -- Prevented infinite loop in FileSystemStorage.save() when a ↵Jacob Walls
broken symlink with the same name exists.
2021-05-13Fixed #32718 -- Relaxed file name validation in FileField.Mariusz Felisiak
- Validate filename returned by FileField.upload_to() not a filename passed to the FileField.generate_filename() (upload_to() may completely ignored passed filename). - Allow relative paths (without dot segments) in the generated filename. Thanks to Jakub Kleň for the report and review. Thanks to all folks for checking this patch on existing projects. Thanks Florian Apolloner and Markus Holtermann for the discussion and implementation idea. Regression in 0b79eb36915d178aef5c6a7bbce71b1e76d376d3.
2021-05-06Refs CVE-2021-31542 -- Skipped mock AWS storage test on Windows.Carlton Gibson
The validate_file_name() sanitation introduced in 0b79eb36915d178aef5c6a7bbce71b1e76d376d3 correctly rejects the example file name as containing path elements on Windows. This breaks the test introduced in 914c72be2abb1c6dd860cb9279beaa66409ae1b2 to allow path components for storages that may allow them. Test is skipped pending a discussed storage refactoring to support this use-case.
2021-05-04Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file uploads.Florian Apolloner
2021-03-19Refs #32508 -- Raised Type/ValueError instead of using "assert" in django.core.Daniyal
2020-09-02Fixed #31941 -- Corrected FileField.deconstruct() with a callable storage.Brian Helba
2020-09-01Fixed CVE-2020-24583, #31921 -- Fixed permissions on intermediate-level ↵Mariusz Felisiak
static and storage directories on Python 3.7+. Thanks WhiteSage for the report.
2020-04-08Refs #28184 -- Added test for FileField storage default.Carlton Gibson
Co-authored-by: miigotu <miigotu@gmail.com>
2020-04-08Fixed #28184 -- Allowed using a callable for FileField and ImageField storage.miigotu
2019-11-06Harmonized Windows checks in tests to a single style.Jon Dufresne
2019-10-31Refs #28428 -- Made FileSystemStorage.save() to support pathlib.Path.Hasan Ramezani
2019-10-31Refs #28428 -- Added tests for using FileSystemStorage with pathlib.Path.Hasan Ramezani
2019-09-25Fixed #25598 -- Added SCRIPT_NAME prefix to STATIC_URL and MEDIA_URL set to ↵Oleg Kainov
relative paths. Thanks Florian Apolloner for reviews. Co-authored-by: Joel Dunham <Joel.Dunham@technicalsafetybc.ca>
2019-08-18Refs #28428 -- Made FileField.upload_to support pathlib.Path.Claude Paroz
2019-08-18Refs #28428 -- Added test for a callable FileField.upload_to that returns ↵Claude Paroz
pathlib.Path.
2019-08-07Corrected several typos in string literals and test names.Min ho Kim
2019-01-31Fixed #30147 -- Simplified directory creation with os.makedirs(..., ↵Jon Dufresne
exist_ok=True).
2019-01-28Fixed #30137 -- Replaced OSError aliases with the canonical OSError.Jon Dufresne
Used more specific errors (e.g. FileExistsError) as appropriate.
2018-12-31Updated test URL patterns to use path() and re_path().Tim Graham