When a providing site is in a subdirectory, Entity Share fails to copy physical files over to the requesting site. The associated file entities are created, but the files themselves are missing.
To reproduce:
- Have two Drupal sites (multisite) installed in subdirectories.
- Create a standard article on one site and sync it to the other.
- The image field physical file is not copied to the destination site.
This appears to be caused by the authentication request in \Drupal\entity_share_client\Service\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',
],
]);
If the providing exists at http://example.com/my-subdirectory
, the leading slash in /user/login
causes the login request to post to http://example.com/user/login
, eliminating the subdirectory name. Apparently this is the way Guzzle intentionally handle absolute directory paths combined with base_uri's with subdirectories, as described at https://stackoverflow.com/questions/25268872/guzzlehttp-client-ignores-b....
Comment | File | Size | Author |
---|---|---|---|
#2 | entity_share-file-user-login-3091899-1.patch | 627 bytes | quicksketch |
Comments
Comment #2
quicksketchHere's a patch that fixes this login issue, which seems to be trivial.
Comment #3
GrimreaperThanks @quicksketch for catching that and for the patch.
I am currently trying to reproduce manually, Doing #3094091: Use dedicated block content type for tests before.
And I am also searching why I did not catch that with #3072238: Tests: file field (entity reference) (tests are failing on this issue only for deprecations), because on d.o tests are in subdirectory so the case should be tested.
Comment #5
GrimreaperPatch merged!
But I am worried that the tests from #3072238: Tests: file field (entity reference) did not catch such a bug.