Problem/Motivation

makeUrlRelative host-pattern does not anchor to the host boundary, so subdomains and other sites containing the domain string match.

For site domain example.com, the regex built is /example\\.com\\//. Applied as a substring match against the full URL, this matches https://subdomain.example.com/node/42 (host contains example.com/). The URL is treated as local and entity usage for /node/42 is recorded, even though the link points to a different host

Steps to reproduce

Proposed resolution

  • Change site_domains config to split out the config into host and path
  • Update UrlToEntity to use new config
  • Fix old config via an update hook
  • Handle IDNs (domains with unicode in them)

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
alexpott’s picture

Issue summary: View changes
alexpott’s picture

Status: Needs review » Reviewed & tested by the community

We've got test coverage and all the tasks from the issue summary are covered.

  • alexpott committed c5b201bb on 5.x
    fix: #3603969 \Drupal\entity_usage\UrlToEntity::makeUrlRelative() does...
alexpott’s picture

Status: Reviewed & tested by the community » 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.

alexpott’s picture

Due to the config update not going to attempt to fix this on 8.x-2.x.

Status: Fixed » Closed (fixed)

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