Problem/Motivation

SiteimproveUrils::getEntityUrls() produces URLs on wrong language and contains twice the domain. Erroneous URL is http://example.comhttps//example.com/my-custom-page.

Steps to reproduce

Not sure about the root cause, but I assume the issue comes with https://www.drupal.org/project/domain module. The site I've faced this does not have submodule domain_access enabled.

Proposed resolution

Use translated entity and do not append the domain to url if its already present.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 3491332-4.patch1.24 KBnicross-com
#2 3491332.patch1.18 KBsokru

Comments

sokru created an issue. See original summary.

sokru’s picture

Status: Active » Needs review
StatusFileSize
new1.18 KB

The patch contains proof-of-concept of the fix, it should be rather safe change.

beltofte’s picture

Assigned: Unassigned » mortenthorpe
nicross-com’s picture

StatusFileSize
new1.24 KB

Thanks for working on this. We found one functional issue with the original patch which can lead to an InvalidArgumentException (invalid translation language). This updated version of the patch adds a hasTranslation() check before calling getTranslation(). Cheers!

  • beltofte committed af0cb927 on 3.0.x
    fix: #3491332 Compatibility with domain module
    
    By: sokru
    By: beltofte...

  • beltofte committed 7d67c7ae on 2.0.x
    fix: #3491332 Compatibility with domain module
    
    By: sokru
    By: beltofte...
beltofte’s picture

Thanks for the issue report and the patches. The issue is originating from Domain Access. Not sure why Domain Access in some cases cause that $entity->toUrl() returns the absolute URL with domain and not the relative URL. I have implemented a fix that is a bit different, to handle cases where the Domain Access domain plugin returns multiple domains.

beltofte’s picture

Status: Needs review » Fixed

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.

Status: Fixed » Closed (fixed)

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