Problem/Motivation
This is a follow-up from #2128055: Files should be uploaded to per year/month directories by default. Because we really needed sane defaults for 8.0.0 instead of uploading all files in the same directory, a consensus was found with YYYY-MM
to at least get something in during the RC triage phase.
Proposed resolution
Improve those defaults as discussed at length in #2128055: Files should be uploaded to per year/month directories by default - Going with [field-storage:name]/[date:custom:Y]-[date:custom:m]
or [field-storage:name]/[date:custom:Y]/[date:custom:m]
still seems to be under discussion. From an auditability perspective, [entity:machine-name]
was also suggested and is not necessarily superior to [field-storage:name]
but simply a different approach.
UX and security concerns have been discussed in #2128055: Files should be uploaded to per year/month directories by default already.
Remaining tasks
Once #2128055: Files should be uploaded to per year/month directories by default has been committed, create a patch based on #2128055-132 to start with. Iterate on it until we've decided what's the final approach we want to go with.
User interface changes
- Users see new tokens in the file directory field defaults
- Users see computed tokens in the URL bar for files
API changes
None.
Data model changes
None.
Comments
Comment #2
catchI don't see how field-storage-name or entity type is a good idea for auditability.
Files can be referenced from multiple different file fields - core widgets don't allow for this, but contrib ones do and can.
So you upload a file to field_name_1 on entity type X, then it gets referenced from field_name_2 on entity_type Y, then the entity type X gets deleted - your file is named with the original field name despite being attached to the new one.
For audits, scanning the files directory and comparing against the database should work, then the file names themselves aren't that relevant.
Comment #3
Dave ReidI feel very strongly that no additional changes should be necessary. It's not like the ability to configure this is hidden at all. Admins can still chose to make changes when setting up the fields, and should do so if they need it. An install profile could even change the default token string for all file and image fields.
Comment #4
rootworkEven if we don't change the defaults, don't we still need to add the new
entity:machine-name
andfield-storage:name
tokens so admins can create these configurations themselves? See webchick's comment in #2128055-153: Files should be uploaded to per year/month directories by default.Comment #5
Dave ReidWe can always provide those in the Token module in contrib for now.
Comment #6
catchMoving to 'needs more info' since I believe the problem (and hence the resolution to the problem) don't take into account the full picture. This was a problem with the initial discussion on #2128055: Files should be uploaded to per year/month directories by default and thanks for splitting it out to a follow-up.
Comment #7
andypostAlso would be great to have a token for translitirated filename
Comment #22
smustgrave CreditAttribution: smustgrave at Mobomo commentedClosing as outdated as there hasn't been any follow up or continuation in 7 years when an issue summary was requested.
If still valid please reopen updating the issue summary
Thanks!