Opened 23 months ago
Last modified 23 months ago
#34237 closed Bug
FileField does not take upload_to into account when setting unique=True — at Initial Version
Reported by: | 0x4A-0x41-0x4B | Owned by: | nobody |
---|---|---|---|
Component: | File uploads/storage | Version: | 4.1 |
Severity: | Normal | Keywords: | FileField, Unique, Storage, Upload |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
#27188 added support for setting unique=True for the FileField.
This does not seem to take the upload_to argument into account.
As upload_to could be used to completely change the name of the uploaded file it should, in my opinion, be considered part of the filename.
Or should at the very least be mentioned in the docs for clarity.
If upload_to is defined, setting unique=True does effectively nothing right now. The file is passed on and a unique filename is generated (->The default behavior of adding an underscore followed by seven random characters) instead of raising an error.