Closed (outdated)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Dec 2012 at 01:19 UTC
Updated:
21 Feb 2018 at 13:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
alan d. commentedAnd also fails on Unix :(
Workaround for a File field
Usage
Comment #2
David_Rothstein commentedI'm using a slightly older version of Migrate, but the rawurlencode() was giving me trouble too, and for remote files in that case (basically anything with an unusual character in the remote file name wouldn't copy correctly).
Is it possible rawurlencode() isn't needed here at all?
Here's the patch I used to remove it. It doesn't apply against the latest 7.x-2.x dev code though (I'm running a bit of an older version), so I'm leaving the issue status at "active" for now.
Comment #3
mikeryanThat piece of code has evolved to urlencode all segments of the path, so won't apply.
Simply removing the urlencoding will break existing migrations depending on it, although I have also run into situations where it's not appropriate (when the incoming paths were already encoded) - we should add a boolean option 'urlencode', defaulting to TRUE for compatibility, then you'll be able to set it to FALSE if it gives you trouble.
Comment #4
mikeryanTagging feature requests I'd like to get into Migrate 2.6.
Comment #5
mikeryanDone, set urlencode to 0 to prevent encoding.
Comment #7
evanbarter commentedI backported this to 2.5.
Comment #8
donquixote commentedI think the real problem here is that
MigrateFileUri::urlencode()is meant only for web urls like http://.., but it also applies to filesystem schema uris like private://.. or public://..As a simple fix, I would suggest to extend the test done in
MigrateFileUri::urlencode(), instead of introducing a setting.@mikeryan:
I'm reopening, but maybe you can clarify why we need a setting for this? Then we could close it again, if I am wrong.
And why do we need rawurlencode() for a url that goes into copy() ? Does copy() need encoded remote urls, but raw local paths?
And if so, how would I apply this setting?
E.g. in my Migrate subclass, for a filefield:
(I had a look at the doc page at https://www.drupal.org/node/1540106, but was a little confused because in many of these examples the first argument to addFieldMapping() does not look like a Drupal field name.)
Comment #9
donquixote commentedOr for a more complete understanding:
- File paths with public:// or private:// or anything that passes file_valid_uri() is a local file and should not ever be urlencoded, no matter what the setting says.
- File paths with http:// or http:// are remote files and need to be urlencoded, BUT the user might already have done this. So here the setting from #5 should apply.
- File paths with e..g randomprotocol:// are tricky, here we have no idea if it is remote or local. We would need some mechanism to find out.
Comment #10
pifagor