If the source path for files contains a query string (which is typical when remote images are being migrated), and the destination_file
is not specified, the destination filename gets the query string suffixed without all the special characters.
For example, http://example.com/images/large-image.jpg?cb=1
gets saved as large-image.jpgcb1
.
The problem is this block of code in \MigrateFileUri::processFile
:
if (empty($this->destinationFile)) {
$this->destinationFile = basename($this->sourcePath);
}
The basename function does not strip out the query string from an URL. We have to do that ourselves.
I think it is safe to do this in MigrateFileUri without checking if it is actually a remote URI as ?
is not typically a valid character for filenames.
Comment | File | Size | Author |
---|---|---|---|
#2 | file_url_s_with_query-2757501-2.patch | 540 bytes | hussainweb |
|
Comments
Comment #2
hussainwebThis patch should fix the problem.
Comment #3
pifagorComment #5
pifagorComment #7
joseph.olstadhttps://www.drupal.org/project/migrate/releases/7.x-2.12