Skip to content

fix(link): unwrap stacked schemes split by whitespace in one pass [3.x] - #253

Merged
ManukMinasyan merged 1 commit into
3.xfrom
fix/link-normalize-stacked-schemes
Oct 5, 2026
Merged

ManukMinasyan merged 1 commit into
3.xfrom
fix/link-normalize-stacked-schemes

Conversation

@ManukMinasyan

Copy link
Copy Markdown
Collaborator

Problem

A domain-variant link that stacks http schemes with whitespace between them re-enters LinkFieldType::normalize() once per scheme. A 2,048 character value, the longest the item rule allows, takes about 250 passes and 47 ms. A host app that normalizes filter operands or import rows with this method pays that for every value.

A separator that trim() leaves in place, such as a non-breaking space or a zero-width space, also came back unparsed.

Change

The unwrap regex skips the whitespace between stacked schemes, using the same class the authority parse already strips. Every stacked form now resolves in at most two passes.

Measured

Value Before After
2,048 chars of http:// 47 ms 0.7 ms
255 chars of the same 3.8 ms 0.24 ms
Normal URL 0.5 ms 0.5 ms

Tests

  • A call-counting test over four separators (space, tab, non-breaking space, zero-width space) failed with 250 passes and passes with 2.
  • A new case in the unparseable-links dataset pins the result for mixed separators.

No stored value changes shape, so no upgrade step is needed.

A domain-variant link that stacked http schemes with whitespace between them re-entered normalize() once per scheme, so a 2,048 character value took about 250 passes and 47 ms. A separator that trim() leaves in place, such as a non-breaking space, came back unparsed. The unwrap now skips the whitespace between schemes, so every stacked form resolves in two passes.
Copilot AI balanced review requested due to automatic review settings October 5, 2026 16:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ManukMinasyan
ManukMinasyan added this pull request to the merge queue Oct 5, 2026
Merged via the queue into 3.x with commit 8c044d7 Oct 5, 2026
7 checks passed
@ManukMinasyan
ManukMinasyan deleted the fix/link-normalize-stacked-schemes branch October 5, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants