Skip to content

Fix URL matching for domain names with port numbers in string replacer#10105

Merged
alecpl merged 1 commit intoroundcube:masterfrom
kizashi1122:fix/link-pattern-port-number
Mar 8, 2026
Merged

Fix URL matching for domain names with port numbers in string replacer#10105
alecpl merged 1 commit intoroundcube:masterfrom
kizashi1122:fix/link-pattern-port-number

Conversation

@kizashi1122
Copy link
Copy Markdown
Contributor

Since commit 2c3b46c ("Fix regression in handling of non-unicode characters in a plain text message"), URLs with domain names and port numbers (e.g. http://example.com:8080/path) are no longer converted into links in plain text messages.

The port number pattern (:[0-9]{1,5})? in $link_pattern was placed inside the $ip_address branch only:

(({$ip_address}(:[0-9]{1,5})?|{$utf_domain})(...))

Since : is excluded from $utf_domain, domain-name URLs stop matching at the colon and the port number is lost.

This moves (:[0-9]{1,5})? outside both branches so it applies to both IP addresses and domain names:

(({$ip_address}|{$utf_domain})(:[0-9]{1,5})?(...))

The existing test case http://link.com:test is unaffected because :test does not match [0-9]{1,5}.

Added test cases for domain-name URLs with port numbers.

@alecpl alecpl added this to the 1.7.0 milestone Mar 8, 2026
@alecpl alecpl merged commit 7cab564 into roundcube:master Mar 8, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants