Upload fails sporadically when using tmp as temporary file location

Created on 9 January 2023, almost 2 years ago
Updated 6 June 2023, over 1 year ago

Problem

Since 8.x-1.0-beta6 and the change of the temporary file location to default "temporary://", some uploads fail sporadically with the error message:

Drupal\Core\Entity\EntityStorageException: File 'temporary://filefield_paths/myfile.pdf' ('/tmp/filefield_paths/myfile.pdf') could not be copied because it does not exist. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (Line 811 in /var/www/foo/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Followed by

Drupal\Core\File\Exception\FileNotExistsException: File 'temporary://filefield_paths/myfile.pdf' ('/tmp/filefield_paths/myfile.pdf') could not be copied because it does not exist. in Drupal\Core\File\FileSystem->prepareDestination() (Line 453 in /var/www/foo/web/core/lib/Drupal/Core/File/FileSystem.php).

In my case "temporary://" maps to "/tmp".

Workaround

Changing the the temporary file location to "private://" does solve the problem.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany pminf Nuremburg (Germany), formerly Dresden

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