Download uploaded files does not work with s3fs

Created on 13 March 2025, 27 days ago

Problem/Motivation

  • Download uploaded files does not work with s3fs

Steps to reproduce

  • Configure a site's private file system to use s3fs
  • Create a webform with a file element, and configure it to use the private (s3fs) file system
  • Upload a file and submit the webform
  • Go to the Results tab, go to Download, select the "Download uploaded files" checkbox, click Download
  • The downloaded archive only contains a csv file, and none of the uploaded files are included in the archive
πŸ› Bug report
Status

Active

Version

6.3

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada andrew.wang

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

Comments & Activities

  • Issue created by @andrew.wang
  • What is the S3 integration with the site? Is there a contributed module like https://www.drupal.org/project/s3fs β†’ involved?

  • πŸ‡¨πŸ‡¦Canada andrew.wang

    Yes, that is correct - the s3fs β†’ contrib module is used.

  • To set up a reproduction someone using S3 will have to try. On the website with this issue:

    1. Is the private file system working normally outside of Webform? That is, do ordinary private file fields function as expected on the website?
    2. Are the private files accessible in the submissions by clicking on the attachments?
  • πŸ‡¨πŸ‡¦Canada andrew.wang

    Yes and yes.

    I was looking at the code, and noticed in /src/WebformSubmissionExporter.php on Line 872, the FileSystemInterface::realpath method is used. From the Drupal API documentation:

    The use of this method is discouraged, because it does not work for remote URIs. Except in rare cases, URIs should not be manually resolved.

    I wonder that might be the reason why it doesn't work with s3fs?

  • πŸ‡ΊπŸ‡ΈUnited States fizcs3 Omaha, Nebraska; USA

    We're having the same issue with webform submissions and S3 uploads (using s3fs module as well), except in our case the S3 file is publicly viewable, not private... so this does not seem to be an issue with privacy.
    When looking through submissions on the Results tab screen, if I click on the link to the uploaded file to S3, the file is viewable.

    In our case, when choosing the PDF format, and "Download uploaded files", as depicted, the submission summary pdfs are downloaded, but the S3 files are skipped without any warnings etc in the dblog. If there is a file element stored locally, it gets downloaded fine.

Production build 0.71.5 2024