Private file access gives 404 not found

Created on 9 January 2025, 13 days ago

Problem/Motivation

On one of my projects, i am not able to access any private file that is in a subdirectory.
I always get a 404 not found.

A classic url would be : https://site.com/system/files/webform/test/_sid_/test1.pdf

I discover that it was never catched by the route "/system/files/".

The reason seem to be in the processInbound() method that overwrite my request and therefore change the filepath parameter.

Steps to reproduce

Not entiterly sure what in my config generate this issue, but i'm using a multisite.
In my (probably particular config), i just have to create a media with a field "file" wich is parametered to store the file in the private directory.
Then create a new media and uplad a file.
Then see that you cannot access this file.

Proposed resolution

Change the processinbound method to keep the filepath attribute on the request.

Release notes snippet

🐛 Bug report
Status

Active

Version

10.3

Component

file system

Created by

🇧🇪Belgium arwillame

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

Merge Requests

Comments & Activities

  • Issue created by @arwillame
  • Merge request !10858remove check that causes access issues → (Open) created by arwillame
  • Pipeline finished with Failed
    13 days ago
    Total: 463s
    #390784
  • I noticed this has something to do with Webform. Is a load balancer in use on this site?

  • Pipeline finished with Failed
    13 days ago
    Total: 368s
    #390795
  • 🇧🇪Belgium arwillame

    My example contain webform, but i had the same issue with a simple media with file stored in the private part. I was not able to access it neither. So i dont think it's linked to webform.
    I had the issue localy as well so i assume it woul not be related to a load balancer issue.

  • Please try to determine the bug reproduction steps with a clean Drupal installation.

  • 🇳🇿New Zealand quietone

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies .

    Since we need more information to move forward with this issue, I am setting the status to Postponed (maintainer needs more info). Having the steps to reproduce will also allow a test to written.

    Thanks!

Production build 0.71.5 2024