At the moment when generating nodes and Add an url alias for each node. is checked, all path aliases are generated with und langcode, even if nodes have a different langcode.

I was testing generated nodes with path aliases with Multiversion module and got errors like this: InvalidArgumentException: Alias path en has to start with a slash. and InvalidArgumentException: Alias path zxx has to start with a slash. in AliasStorage::save() when the node langcode and its alias langcode are different.

I've attached a patch with a fix for this, all it does is to send the node langcode as argument to the AliasStorage::save(), this way it will use the correct langcode, not the default one (und).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeqq created an issue. See original summary.

jeqq’s picture

Issue summary: View changes
jeqq’s picture

Title: Set the path alias langcode when generating nodes with aliases » Set the correct path alias langcode when generating nodes with aliases

Status: Needs review » Needs work

The last submitted patch, correct-alias-langcode.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jeqq’s picture

jeqq’s picture

  • willzyx committed 91a1e5b on 8.x-1.x authored by jeqq
    Issue #2944180 by jeqq: Set the correct path alias langcode when...
willzyx’s picture

Status: Needs review » Fixed

@jeqq Thanks for contributing! committed and pushed to 8.x

Status: Fixed » Closed (fixed)

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