File migration fails when the file path contains white space(s).

Problem occurs in MigrateFile::copyFile() in plugins/destinations/file.inc at line 336.

if (!@copy($this->sourcePath, $destination)) {

This is easily fixed by replacing the line with:

if (!@copy(str_replace(' ', '%20', $this->sourcePath), $destination)) {

Comments

mikeryan’s picture

Status: Active » Fixed

This is already fixed in -dev.

Status: Fixed » Closed (fixed)

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

stockliasteroid’s picture

Status: Closed (fixed) » Active

Sorry to resurrect this, but I upgraded to -dev and a large number of my files started failing to import. All of the failures have spaces in the filenames, which Migrate is replacing with %20 as outlined above. For some reason that's causing the copy to fail, because the with 2.4 without the %20 replacement it worked fine. Could this be some kind of OS-specific issue? I've run the same migrations prior to upgrading to -dev on both OSX and Ubuntu machines and they worked on both, but now work on neither with -dev. I reverted back to 2.4 and now it works fine again...

Let me know if I should open a new issue, but this is definitely tied to this change.

stockliasteroid’s picture

Version: 7.x-2.4 » 7.x-2.x-dev

Changing version.

mikeryan’s picture

Status: Active » Closed (fixed)

Please don't tack on to closed issues - always open a fresh issue. When you do, please look at examples of filenames which no longer work versus those that do - you may find that the failures are where the filename is already urlencoded.

stockliasteroid’s picture

Yeah, thought I'd get slapped for that. I considered this a regression, and thus the same issue would apply. My apologies: #1800616: Whitespace in file uri is urlencoded and breaks file copy with MigrateFileUri

stockliasteroid’s picture

Issue summary: View changes

Formatting