Image preview and S3fs

Created on 2 February 2023, over 1 year ago
Updated 7 April 2023, about 1 year ago

Problem/Motivation

When creating a new entity with an image field, the image preview do not appear and neither is it copied to S3.

It is only once the entity has been saved, that the image does load.

This leave content creators quite confused (especially as they need to crop said images...)

Steps to reproduce

We use S3fs with these settings:
// Enable Drupal private file system.

$settings['file_private_path'] = 's3://';
// // Enable S3fs private file system.
$settings['s3fs.use_s3_for_public'] = false;
$settings['s3fs.use_s3_for_private'] = true;
$settings['s3fs.upload_as_private'] = true;

We get an access denied error, for the image url as an anonymous user :
Path: /XXX/YYYY.jpg. Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: in Drupal\system\FileDownloadController->download() (line 80 of /opt/drupal/web/core/modules/system/src/FileDownloadController.php).

πŸ› Bug report
Status

Closed: cannot reproduce

Version

3.1

Component

Code

Created by

πŸ‡«πŸ‡·France Thony

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

Comments & Activities

  • Issue created by @Thony
  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    Drupal\system\FileDownloadController->download() (line 80 of /opt/drupal/web/core/modules/system/src/FileDownloadController.php

    This is the Drupal Core provider controller and is not provided by s3fs. Line 80 corresponds to the scenario where no module has granted access to the file or that a module has specifically rejected access.

    Normally Core will grant access to the file uploader while it is unsaved however it is possible contrib modules may be overriding that behavior.

    I’m not really sure here of the scenario. Since this is the FileDownloadController path it sounds like we are not discussing image styles (as those go through ImageStyleDownloadController but still subject to core ACL’s).

    At the moment this sounds like this may be an issue outside of s3fs, postponing on more information being provided on how to reproduce this.

  • Status changed to Active over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States chucksimply

    Same issue here... image preview on upload is broken. Saving the node, then re-editing, the preview shows correctly.

    All worked fine on 8.x-3.0-rc2. The issue only started after the update to 8.x-3.1

  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    This issue needs steps to reproduce as it does not appear in my lab when using a standard install profile, an image field with the default thumbnail image style display and the file path set to private:// with s3 takeover.

    If you can provide the steps to reproduce from a vanilla standard Drupal with s3fs installed this can be investigated more.

  • πŸ‡ΊπŸ‡ΈUnited States chucksimply

    Turns out my issue is with the File Field Path module... see the attached issue. This may be the same problem for the issue creator as well.

  • Status changed to Closed: cannot reproduce about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    As the OP has not given additional details on being able to narrow this down to s3fs, and an alternative theory has been shown for outside of s3fs, I’m going to close this as could mo reproduce.

    If the OP or another can reproduce this and determine a fault inside of s3fs it may be re-opened.

Production build 0.69.0 2024