Closed (fixed)
Project:
Drupal core
Version:
8.1.x-dev
Component:
migration system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 Mar 2016 at 22:07 UTC
Updated:
11 Jul 2016 at 14:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
floydm commentedMy workaround, for the moment, is to subclass the CckLink process plugin and override the transform method, changing:
to:
And then in my migration yml switching all link fields to use my process plugin instead of cck_link. If I do that and rerun my migration, the migrated nodes with the links load fine.
That's in a migration to 8.0.5. Customizing a d6 migration to 8.1 has me baffled.
Comment #3
catchComment #4
mikeryanLet's get some sprinters (novice welcome) to test this on both D6 and D7 - do you see this problem with migrating link fields?
Comment #5
ancapaaron commentedYes, this problem still persists. Confirmed the steps to reproduce:
Used Drupal versions:
Drupal 6.38
migrated to
Drupal 8.2.x
Below is the error message when attempting to view the offending node:
----------------------------------------------------------------------------------------------------
The website encountered an unexpected error. Please try again later.
InvalidArgumentException: The URI 'test' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 276 of core/lib/Drupal/Core/Url.php).
Comment #6
swentel commentedI think I even saw it happening with the frontpage (or maybe 403, or 404 link) on the system settings screen. Going to the frontpage throws an error then, but I'll make sure I can confirm.
Comment #7
bsnodgrass commentedIn the process of testing if this is an issue in D7 with Link 7.x-1.4 - the link field does not allow for an invalid URL, instead resenting an error message:
"The value test provided for Link is not a valid URL."
This may not be an issue with a Link field in D7 migrations
Comment #8
mikeryan@ancapaaron and @bsnodgrass - thanks for the manual testing.
Next step here is updating the automated tests to catch this - notably, the link fields in both Drupal 6 and Drupal 7 fixtures are all full HTTP links, we need to test with local links.
Comment #9
quietone commentedAdding tags for Drupal source and destination version. migrate-d7-d8 added based on mikeryan's comment (#8) about changing the test data in both the D6 and D7 fixtures.
Comment #10
quietone commentedComment #11
quietone commentedChanged the d6 dump and added a test for an internal link.
Comment #13
heddnComment #14
vasi commentedI don't think the slash matters. Importing '/node/10' also fails with the same message.
Comment #15
vasi commentedHere's an attempted fix. There's a bit of almost-duplicated code from LinkWidget, but I'm not sure if there's any good way to abstract it out—we want to auto-add a slash, and they don't.
Comment #16
heddnTaking off novice. There isn't a clear enough path forward for a novice to pick this up. Are we sure that
internal:is necessary? Doesn't it depend on the type of link field? There are three types, store only internal. Store external or store mixed. Are all of these treated the same way?Comment #17
vasi commented@heddn: I believe internal: is always necessary for D8 link fields, unless the link data is external. We check if it's external before adding "internal:".
For migrating the content, we don't particularly care what the D6 link field settings are—we just handle any type.
Comment #18
quietone commentedOver in #2345833: Convert assetEqual to assertIdentical in migrate_drupal it was decided to use assertIdentical instead of assertEquals.
Comment #19
vasi commentedOh, thanks for the note. I just assumed I would use the one not marked @deprecated, but I'll go with the flow :)
Comment #20
mac_weber commentedassertIdenticalis deprecated. UseassertSame.Comment #23
mac_weber commentedtestbot hiccup, working again
Comment #24
quietone commented@vasi, sorry about that.
Comment #25
sam152 commentedAdded a unit test. I'm not sure what all the test cases are, but they can be added to the data provider by the other contributors.
Comment #27
mikeryanGenerally looks good, thanks! Some feedback...
This is a D6-specific plugin.
A rather subtle means of prepending - would it be clearer and/or more efficient to do something like
?
Let's also test with the leading slash, just to make sure we don't accidentally double it up.
Am I correct in assuming the fixture has no leading-slash cases? As previously, let's add one.
Comment #28
mikeryanIs it worth looking at the patch in #2674090: Unable to migrate D7 link fields and seeing what might be shared between the two?
Comment #29
sam152 commentedBoth of these issues look like they are practically solving the same problem. Can we use the same process plugin for both migrations?
Also, not sure we need to add every test case to the fixture with the unit test.
Comment #30
vasi commentedI think it would be good to use the same process plugin. Once we do that, we could also use the same CckField too!
The only critical difference between the process plugins now is that the D7 one tries to turn links into 'entity:' URIs:
I'm not sure if this is something we want. There's no way to tell whether the creator of the D6 content intended to link to "the node currently at this path, even when it changes path" or "whatever is at this path, even if it's later something different".
I'd recommend that for now we go with this patch as-is, assuming it's well-reviewed. Then in #2674090: Unable to migrate D7 link fields we can handle merging the process and CckField plugins.
Comment #31
vasi commentedIn addition the the things we already looked at, there's the existing internal_uri process plugin, and also one being added by #2669978: Migrate D7 Menu Links. We probably want to find a way to coalesce these.
Comment #32
quietone commentedThis change is a mistake and has been removed. I must have ticked the checkbox before creating the initial patch.
Yes, that is correct. Drupal6 didn't allow me to enter a leading slash to a link. Therefor, I have added a leading slash test in MigrateNodeTest.php. This works for internal links. With an external link, it prepends 'internal:' resulting in 'internal:/https://www.drupal.org/node/2127611'.
I agree with vasi on getting this in and then dealing with the other link related issues.
Comment #34
quietone commentedFailures are unrelated to this patch, and pass locally. Retesting.
Comment #35
quietone commentedTests passing now, so NR.
Comment #36
mikeryanThis is a 6-only plugin.
Otherwise looks fine - the comment can be fixed on commit.
Comment #38
mikeryanTest failure looks irrelevant, requeued.
Comment #41
catchFixed on commit - 'a leading'. And also the Drupal 7 mention per #36
Committed/pushed to 8.2.x and cherry-picked to 8.1.x. Thanks!