Allow minimal token support for upload location

Created on 10 December 2020, almost 4 years ago
Updated 4 July 2023, over 1 year ago

Problem/Motivation

When uploading files to the temporary location, f.e. via a media form, but the entity does NOT get saved (meaning it does also not get moved by the module), the uploaded file will remain in the temporary directory. This leads to renaming of newly uploaded files that have the same name as the original, because there is already a file present with that name in the temporary location. So newly uploaded files will be renamed with a suffix like "_0". Sadly, also the moved files after saving the new entity will get that suffix, too.

To prevent that, the temporary directory could support tokens, to f.e. write the uploaded files to subdirectories based on timestamps. This would prevent the renaming of files on upload, if prior uploads were not successfull or submitted.

Proposed resolution

See attached MR.

  • Added support for tokens on configuration form
  • Added support for tokens on temporary directory
  • Fixed bug, where the $source_scheme_name always got "public" even if the temporary location is set to "private", leading to failed deletion of empty directories after moving the files.

Remaining tasks

Review by community and maintainers.

User interface changes

Added token UI link to configuration form

API changes

None.

Data model changes

None.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024