[PR #455] [MERGED] fix: skip locale prefix for absolute and protocol-relative Link hrefs #583

Closed
opened 2026-05-06 13:08:54 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/455
Author: @NathanDrake2406
Created: 3/11/2026
Status: Merged
Merged: 3/11/2026
Merged by: @james-elicx

Base: mainHead: fix/link-locale-absolute-urls


📝 Commits (2)

  • 5e2369f fix: skip locale prefix for absolute and protocol-relative Link hrefs
  • ba458ab fix: skip locale prefix for absolute and protocol-relative URLs in applyNavigationLocale

📊 Changes

4 files changed (+84 additions, -0 deletions)

View changed files

📝 packages/vinext/src/shims/link.tsx (+6 -0)
📝 packages/vinext/src/shims/router.ts (+5 -0)
📝 tests/link.test.ts (+24 -0)
📝 tests/shims.test.ts (+49 -0)

📄 Description

Summary

  • applyLocaleToHref() blindly prepended /${locale} to any href, producing malformed URLs like /fr/https://example.com/about or /fr///example.com/about for absolute and protocol-relative hrefs
  • Guard against http://, https://, and // URLs before applying the locale prefix — these should pass through unchanged

Test plan

  • 3 new tests (RED → GREEN): absolute https, protocol-relative, absolute http — all confirmed failing before fix
  • All 41 link tests pass
  • All 652 shims tests pass
  • Typecheck and format clean
  • CI (Format, Lint, Typecheck, Vitest, Playwright E2E)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/455 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 3/11/2026 **Status:** ✅ Merged **Merged:** 3/11/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/link-locale-absolute-urls` --- ### 📝 Commits (2) - [`5e2369f`](https://github.com/cloudflare/vinext/commit/5e2369f80d88436aa960683beb6aa27660171323) fix: skip locale prefix for absolute and protocol-relative Link hrefs - [`ba458ab`](https://github.com/cloudflare/vinext/commit/ba458abde322579252884451c6270cec972c5879) fix: skip locale prefix for absolute and protocol-relative URLs in applyNavigationLocale ### 📊 Changes **4 files changed** (+84 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/link.tsx` (+6 -0) 📝 `packages/vinext/src/shims/router.ts` (+5 -0) 📝 `tests/link.test.ts` (+24 -0) 📝 `tests/shims.test.ts` (+49 -0) </details> ### 📄 Description ## Summary - `applyLocaleToHref()` blindly prepended `/${locale}` to any href, producing malformed URLs like `/fr/https://example.com/about` or `/fr///example.com/about` for absolute and protocol-relative hrefs - Guard against `http://`, `https://`, and `//` URLs before applying the locale prefix — these should pass through unchanged ## Test plan - [x] 3 new tests (RED → GREEN): absolute https, protocol-relative, absolute http — all confirmed failing before fix - [x] All 41 link tests pass - [x] All 652 shims tests pass - [x] Typecheck and format clean - [x] CI (Format, Lint, Typecheck, Vitest, Playwright E2E) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:54 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#583
No description provided.