#1718980: Whitespace in file uri throws MigrateException introduced a change to deal with a lack of URL encoding in file URIs, but seems to have broken migrations with MigrateFileFid with source file URIs that include whitespace.

As a demo, update migrate to -dev, and install the migrate_extras_media module. In the source XML doc migrate_extras_media.xml, change the filename from file-ok.png to "file ok.png". Make the same change to the file-ok.png image in the source_files directory, so it matches the XML doc. Then run the migration. It will fail with:

The specified file sites/all/modules/contrib/migrate_extras/migrate_extras_examples/migrate_extras_media/source_files/images/watchdog%20ok.png could not be copied to public://watchdog ok.png.

The same migration works fine with the same data against 2.4.

In my case I'm pulling filenames out of a legacy MySQL DB that has filenames with spaces in them, and they are NOT urlencoded in the source DB. My first step in debugging before I found out this was a change in -dev was to urldecode the filenames in prepareRow, which did not work, because migrate is urlencoding internally, as in the referenced issue. I then verified that none of the source data was urlencoded, so this is definitely internal to migrate.

Perhaps this is specifically an issue only when using MigrateFileFid?

Comments

mikeryan’s picture

Status: Active » Postponed (maintainer needs more info)

I believe the fix I just committed for #1780850: Inconsistent urlencoding should fix things for you as well, can you pull the latest -dev and try that?

Thanks.

mikeryan’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.