Skip to content

Relative URLs returned unchanged by getFrontendUrlWithSite() instead of being rewritten to absolute frontend URLs #903

Description

@kitzberger

When UrlUtility::getFrontendUrlWithSite() receives a relative URL (e.g. /powermail/optin/{hash}/{mail}), it returns it unchanged instead of prepending frontendBase. This breaks any code generating URLs in contexts where only relative paths are available (CLI commands, email rendering via StandaloneView), such as powermail double-opt-in confirmation links.

Root cause: PR #890 attempted to fix external URLs being incorrectly rewritten by adding $targetUri->getHost() === '' to the early-return guard. However, this was too broad — relative URLs have no host, so the condition short-circuits on all relative URLs before any rewriting can occur. PR #891 then refined external URL detection with isExternalUrl() and $backendDomains, but kept the faulty empty-host check intact.

Fix: Remove the $targetUri->getHost() === '' condition from the early return and add an empty-host guard to isExternalUrl() so relative URLs are recognized as non-external and proceed to rewriting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions