Remote filestreams break with the document redirect.

Created on 23 October 2020, about 4 years ago
Updated 13 October 2023, about 1 year ago

Problem/Motivation

Currently if you use a remote file stream module, like s3fs, the document redirects will fail with the following error:
Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it

Steps to reproduce

  1. Install the S3FS module and Media Entity File Redirect.
  2. Set the File media type to default to the 'S3 File System'
  3. Attempt to link to a File media item that's uploaded to S3

Proposed resolution

Refactor the module slightly to use the CacheableRedirectResponse if the stream is flagged as LOCAL (or one of its variants), otherwise use the TrustedRedirectResponse. This seems to work fine with both local streams and remote streams.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jacobbell84

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

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