I am having a 'Missing file: /file/name.jpg' error when trying to synchronise content among sites.
The sites are multisite instances.

After some digging, I see that this is a user permission error, see the attached screenshot from xdebug.

The error is gone if I remove the following section from the RemoteManager::prepareClient()

    $http_client->post('/user/login', [
      'form_params' => [
        'name' => $remote->get('basic_auth_username'),
        'pass' => $remote->get('basic_auth_password'),
        'form_id' => 'user_login_form',
      ],
    ]);
CommentFileSizeAuthor
shot_20183001-145616.png392.74 KBmsti
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

msti created an issue. See original summary.

Grimreaper’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

Hello,

It depends on the user you use to connect to the server website. It should have the permission to access the file.

msti’s picture

Thank you for your reply.
This file is in the public:// directory, server by apache directly. Why is it checking for file access?

Grimreaper’s picture

For JSON API endpoints, there is no need to authenticate the user on /user/login because it can be authenticated on the fly with the basic_auth.

When trying to access files URL to retrieve the content, the file URL is no a JSON API endpoint so the user needs to be authenticated before and to store the authentication cookie.

I agree that for public files, there is no need for that, but it is required for private files or other stream wrappers.

And we need a generic solution for all stream wrappers, so we authenticate the user on the user login form.

Grimreaper’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
Issue tags: +DevDaysLisbon, +DevDaysLisboa
Related issues: +#2930801: Support for HTTP authentication

Hi msti,

I am closing the issue as there is no reply since 5 months.

Also, Is your website behind and HTTP authentication? If so, maybe it is related to #2930801: Support for HTTP authentication.

Feel free to reopen if needed, providing more info on your server and website setup.