Anonymous users can't submit screenshots

Created on 28 July 2025, 28 days ago

Problem/Motivation

When an anonymous user submits a screenshot, the file is created but the reference file on the feedback entity stays empty.
It seems to be because ManagedFile::valueCallback() checks if the user has access to the file and if they don't it removes the FID value.

Steps to reproduce

Allow anonymous users to create feedbacks.
As an anonymous user, browse to /admin/content/website-feedback/add.
Take a screenshot and submit the form: the saved feedback does not have a screenshot.

Proposed resolution

FileAccessControlHandler::checkAccess() checks the anonymous_allowed_file_ids value in the session to see if an anonymous user can access a private file.
ScreenshotWidget::valueScreenshotWidget() should add the FID of the new file to the session.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇫🇷France prudloff Lille

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

Merge Requests

Comments & Activities

  • Issue created by @prudloff
  • Merge request !13Add anonymous_allowed_file_ids value → (Open) created by prudloff
  • 🇮🇳India divya.sejekan

    Not able to reproduce , I can see the screenshot attachment in submitted feedbacks.
    Can you specify if there are any other steps , I have followed as in description
    Steps Followed :
    1. Enable website feedback
    2. Enable screenshot option in website feedback settinngs
    3. Provide permission to the anonymous user to submit feedback
    4. As anonymous user submit the feedback
    5. Check the submitted feedback

    - I can see the screenshot which was submitted in feedback

  • 🇫🇷France prudloff Lille

    I can reproduce the problem with your steps.
    I suppose we have a difference in our environments.

    Do you have private files enabled? It seems I don't have this problem if the screenshot is uploaded to the public file system.
    You could try adding this at the beginning of steps to reproduce:
    1. Add $settings['file_private_path'] = '/foo/'; in settings.php.
    2. Rebuild cache (drush cr).
    3. Browse to /config/media/file-system and set the default scheme to private.
    4. Rebuild cache (drush cr).

  • 🇬🇧United Kingdom schillerm

    Hi there, testing this using D11.2.2 site with website-feedback version 1.1.0.

    I was able to reproduce this error when submitting as an anon user and with the setting "Default download method = Private local files served by Drupal". Result is screenshot not showing.

    I was also able to reproduce the error when submitting directly from the admin/content/website-feedback page (also as anon user + private setting). Same result - screenshot not showing.

    If I ran the same two tests with the setting "Default download method = Public local files served by the webserver". Result was that - Screenshots did show.

    Then I retested using issue branch 3538394-. In all test combinations (Private or Public, Sidebar or Add page) the screenshots show ok.

    +1 for RTBC

Production build 0.71.5 2024