domain_path_pathauto creates duplicate aliases

Created on 11 June 2022, over 2 years ago
Updated 4 July 2024, 7 months ago

Problem/Motivation

In a setup with domain_path_pathauto the module creates duplicate aliases for pages in some cases where the specific content type uses custom paths.

Steps to reproduce

Create 3 content items with the very same name for a content type which has a specific sub url in your setup. The third entry will get the same URL as the second.

Proposed resolution

See patch attached (will be in added in an hour after issue creation). domain_id was not passed while checking if alias is already reserved within domain_path.

πŸ› Bug report
Status

Active

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡·Brazil carolpettirossi Campinas - SP

    I'm still facing the issue of duplicated paths when I try to edit an existing page.

    1. I've noticed duplicated aliases on URL Aliases page
    2. Edited one of them adding -0
    3. Edited the node of the alias that I added -0
    4. Alias reverted to old value

    I'm attaching a screencast of the steps above.

  • πŸ‡§πŸ‡·Brazil carolpettirossi Campinas - SP

    It looks like the issue is on DomainPathAliasManager::getPathByAlias().

    In PathautoGenerator::createEntityAlias, this is called:
    $this->aliasUniquifier->uniquify($alias, $source, $langcode);
    Then on AliasUniquifier::uniquify,
    $this->aliasManager->getPathByAlias($alias, $langcode)
    which calls
    DomainPathAliasManager::getPathByAlias()

    I'm not sure how to fix this. Any suggestion from maintainer would be appreciated

  • πŸ‡§πŸ‡·Brazil carolpettirossi Campinas - SP

    I'm pretty sure this is NOT the proper solution but I have applied this patch/hack on the pathauto module.

  • πŸ‡§πŸ‡ͺBelgium gorkagr

    Hi!

    Not sure if it is the same issue or not, as i did not see anything related with the "Send all affiliates" field.
    I have opened smth similar with a patch provided there ( https://www.drupal.org/project/domain_path/issues/3452676#comment-15628074 πŸ› Assuming 'field_domain_all_affiliates' exists create duplicate aliases Needs review )

  • πŸ‡ΊπŸ‡¦Ukraine gilmord πŸ‡ΊπŸ‡¦Ukraine

    @gorkagr looks like it is same issue and your changes fix it, tested it

Production build 0.71.5 2024