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

anavarre created an issue. See original summary.

catch’s picture

I 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.

Dave Reid’s picture

I 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.

rootwork’s picture

Even if we don't change the defaults, don't we still need to add the new entity:machine-name and field-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.

Dave Reid’s picture

We can always provide those in the Token module in contrib for now.

catch’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs issue summary update

Moving 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.

andypost’s picture

Also would be great to have a token for translitirated filename

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Closing 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!