FileNotFoundException error when file does not exist

Created on 30 September 2024, 3 months ago

Problem/Motivation

When the file not exits cdn shows an exception error.

Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException: The file "public://documents/012-0001.jpg" does not exist in Symfony\Component\HttpFoundation\File\File->__construct() (line 36 of /var/www/html/vendor/symfony/http-foundation/File/File.php).

Symfony\Component\HttpFoundation\BinaryFileResponse->setFile('public://documents/012-0001.jpg', NULL, , ) (Line: 52)
Symfony\Component\HttpFoundation\BinaryFileResponse->__construct('public://documents/012-0001.jpg', 200, Array, 1, NULL, , ) (Line: 80)
Drupal\cdn\CdnFarfutureController->download(Object, 'delNSoplsZbTBup2m8u0n1Q3hIR8S187DVeN3xqkEmo', 1726651659, 'public')

Steps to reproduce

Create file, then remove file from files and request the url.

Proposed resolution

Validate if file exists, else show the common not found.

🐛 Bug report
Status

Active

Version

4.1

Component

Code

Created by

🇪🇸Spain keopx Basque Country

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

Comments & Activities

Production build 0.71.5 2024