When delete a translation, the url alias for that node is also deleted.

Steps to reproduce:

  • Add translation for a specific content with the same alias
  • Delete the translation
  • Try to access the original content with the path alias

Results:
The path alias were deleted for both contents

Expected result
The path alias is deleted only for the translated content.

We came up with a solution to add the content langcode in the query to select the path IDs (pid)

Comments

geovanni.conti created an issue. See original summary.

geovanni.conti’s picture

geovanni.conti’s picture

Status: Active » Needs review
emartoni’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new14.77 KB
new38.64 KB
new31.58 KB

Patch works great!

Evidence attached that before, the alias is removed with the translation.

Best,
Eduardo

renatog’s picture

Patch #2 sounds good for me too!

+1 to RTBC.

Best,

berdir’s picture

Priority: Normal » Critical
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests
+++ b/src/AliasStorageHelper.php
@@ -203,6 +203,13 @@ class AliasStorageHelper implements AliasStorageHelperInterface {
 
+    if ($langcode) {
+      $and_group = $select->andConditionGroup()
+        ->condition('langcode', $langcode);
+
+      $select->condition($and_group);
+    }

There is no reason to use a condition group here with a single language/condition, just add it to the select?

Also, we need a test, to not break this again.

berdir’s picture

Priority: Critical » Normal

I reverted some changes that likely caused this, so I don't think this can be rerproduced in 8.x-1.2 but we should make sure to have tests.

damienmckenna’s picture

Component: Code » I18n stuff
Chris Charlton’s picture

Stalled or still needed?

mrharolda’s picture

Looks like this is already committed?

damondt’s picture

Not sure if this is the same issue, but programmatically changing a node's language without first changing the pathalias' language results in the pathalias entity being deleted.

I could make a new issue for this if it's not the same thing.

damondt’s picture

Also seeing the alias deleted if a node's language is changed through the ui.

mably’s picture

Status: Needs work » Closed (outdated)

Not sure problems described in #11 and #12 are pathauto related.

Feel free to reopen otherwise.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.