Opened 2 months ago

Last modified 2 months ago

#35604 closed Bug

Unexpected behaviour of FileSystemStorage.exists() due to latest changes — at Version 1

Reported by: Stefan Hammer Owned by:
Component: File uploads/storage Version: 5.1
Severity: Release blocker Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Stefan Hammer)

With this ticket I would like to vote against the latest changes to FileSystemStorage.exists() with #35326.
The very basic file storage operation "exists" now returns False, if the option allow_overwrite is set to True, no matter if the file actually exists or not (see Github).
I know, the default behavior is unchanged (allow_overwrite is False by default), but nevertheless the change seems to me more like the easiest option, but not the cleanest for the API. Until now, the API was very self-explanatory.

The storages API is perfect due to its simplicity and extensibility, and we're using it extensively due to packages like django-storages. I think we should keep it that simple and rethink the above change of the basic "exists" operation, which in my opinion should return exactly that information.
Maybe we should also adapt the documentation for exists(), as it can be interpreted in multiple ways (see here and here).

I probably wouldn't have noticed this change until its occurrence in the next LTS, but (luckily) django-storages has synced the above changes into its latest version, which lead to a bug report with multiple affected people here.

Change History (1)

comment:1 by Stefan Hammer, 2 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top