D7 Private file migrations use of source file_private_path variable creates wrong directory structure

Created on 30 March 2020, over 4 years ago
Updated 5 March 2024, 10 months ago

I am migrating from a Drupal 7 site hosted on Pantheon to Drupal 8.8.4. I am using the migrate upgrade module and running the commands through drush.

The public files all imported correctly, including the files in subdirectories. But I can't get any of the private files to work. I can't tell if the issue is the private files or the subdirectories (all of the private files are in subdirectories so it's hard to isolate).

When I run drush migrate:import upgrade_d7_file_private and check the migrate messages I get errors such as Cannot read from non-readable stream (http://[hostname]/sites/default/files/private/subdirectory/file.pdf)

I see the MigratePrivateFileTest.php test passes, so I assume it's not just private files only that are the problem. The test sets the private directory at sites/default/private, but Pantheon requires it to be at sites/default/files/private. Maybe that is the problem?

I tried creating a test for that scenario (file_private_path set to sites/default/files/private, no further subdirectories) and it fails. But I also tried creating a test for public files in subdirectories (which works on my site migration) and that test fails too so something is not correct about my test.

I'm attaching a patch with those two tests. If anyone has advice on making the MigrateFileSubdirectoryTest.php pass (since I believe the functionality is working) then I can make a tests that shows my problem better.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
MigrationΒ  β†’

Last updated 3 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States sagannotcarl

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024