PathProcessorFiles gives 404 error when processed twice

Created on 2 May 2024, about 2 months ago

Problem/Motivation

The issue occurs when the PathProcessorFiles is invoked twice, resulting in the incorrect handling of file downloads. This problem arises when the PathProcessor is called twice by custom code, causing the $request->query->has('file') to be set and preventing the proper inbound process from being triggered. This issue is not present in a clean Drupal installation, but it can occur when the PathProcessor needs to be invoked again, such as in a Fast404 checker.

Steps to reproduce

Install Drupal with the Webform module.
Create a scenario where the PathProcessorFiles should be invoked twice.
Access the file download URL and observe that the PathProcessorFiles is no longer triggered and results in a 404 page.

Proposed resolution

To address this issue, a patch was made to the PathProcessorFiles inbound processor. The processor now checks if the path starts with '/system/files'. If this condition is met and the 'file' query parameter is not set, the 'file' query parameter is set based on the file path. The processor then returns '/system/files', ensuring that the proper inbound processing is triggered.

Remaining tasks

Test the proposed solution to verify that it resolves the issue without introducing any regressions.

User interface changes

There are no user interface changes associated with this patch.

API changes

There are no API changes associated with this patch.

Data model changes

There are no data model changes associated with this patch.

Release notes snippet

This patch addresses the issue where the PathProcessorFiles was not being invoked correctly due to the processInbound function being called twice. The patch ensures that the PathProcessorFiles is triggered as expected, allowing for proper file downloads in scenarios where this issue is present.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
SystemΒ  β†’

Last updated 2 days ago

No maintainer
Created by

πŸ‡³πŸ‡±Netherlands Remco Hoeneveld

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024