[PR #148] [MERGED] fix: decode request pathname once at entry point for consistent routing #346

Closed
opened 2026-05-06 12:39:21 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/148
Author: @southpolesteve
Created: 2/27/2026
Status: Merged
Merged: 2/27/2026
Merged by: @southpolesteve

Base: mainHead: public/fix-decode-once-at-entry


📝 Commits (1)

  • e90c2ef fix: decode request pathname once at entry point for consistent routing

📊 Changes

6 files changed (+224 additions, -42 deletions)

View changed files

📝 packages/vinext/src/config/config-matchers.ts (+2 -1)
📝 packages/vinext/src/index.ts (+13 -3)
📝 packages/vinext/src/server/app-dev-server.ts (+11 -11)
📝 packages/vinext/src/server/app-router-entry.ts (+13 -15)
📝 packages/vinext/src/server/middleware.ts (+10 -1)
📝 tests/shims.test.ts (+175 -11)

📄 Description

Summary

  • Ensures the pathname is decoded exactly once (via decodeURIComponent + normalizePath) at the request entry point
  • All downstream consumers (middleware, config matchers, route matching) now receive the same canonical path
  • Removes redundant decodeURIComponent calls from matchRoute and matchConfigPattern catch-all branches
  • Middleware always receives a Request with the decoded pathname, not the raw URL

Previously, some code paths decoded the pathname a second time, which could cause inconsistent matching between middleware and routing when percent-encoded characters were present in the URL.


🔄 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/148 **Author:** [@southpolesteve](https://github.com/southpolesteve) **Created:** 2/27/2026 **Status:** ✅ Merged **Merged:** 2/27/2026 **Merged by:** [@southpolesteve](https://github.com/southpolesteve) **Base:** `main` ← **Head:** `public/fix-decode-once-at-entry` --- ### 📝 Commits (1) - [`e90c2ef`](https://github.com/cloudflare/vinext/commit/e90c2ef6eae1347d0044e3961f3c136c712397dc) fix: decode request pathname once at entry point for consistent routing ### 📊 Changes **6 files changed** (+224 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/config/config-matchers.ts` (+2 -1) 📝 `packages/vinext/src/index.ts` (+13 -3) 📝 `packages/vinext/src/server/app-dev-server.ts` (+11 -11) 📝 `packages/vinext/src/server/app-router-entry.ts` (+13 -15) 📝 `packages/vinext/src/server/middleware.ts` (+10 -1) 📝 `tests/shims.test.ts` (+175 -11) </details> ### 📄 Description ## Summary - Ensures the pathname is decoded exactly once (via `decodeURIComponent` + `normalizePath`) at the request entry point - All downstream consumers (middleware, config matchers, route matching) now receive the same canonical path - Removes redundant `decodeURIComponent` calls from `matchRoute` and `matchConfigPattern` catch-all branches - Middleware always receives a Request with the decoded pathname, not the raw URL Previously, some code paths decoded the pathname a second time, which could cause inconsistent matching between middleware and routing when percent-encoded characters were present in the URL. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:39:21 +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#346
No description provided.