Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit c515bf5

Browse files
committed
Keep letter case in routing
1 parent bf794c1 commit c515bf5

File tree

3 files changed

+1
-3
lines changed

3 files changed

+1
-3
lines changed

lib/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const builtinModuleExts = ["tsx", "ts", "mts", "jsx", "js", "mjs"];
88
export function matchRoutes(url: URL, routes: Route[]): [ret: URLPatternResult, route: RouteMeta][] {
99
let { pathname } = url;
1010
if (pathname !== "/") {
11-
pathname = util.trimSuffix(url.pathname, "/").toLowerCase();
11+
pathname = util.trimSuffix(url.pathname, "/");
1212
}
1313
const matches: [ret: URLPatternResult, route: RouteMeta][] = [];
1414
if (routes.length > 0) {

lib/util.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export default {
6666
splitPath(path: string): string[] {
6767
return path
6868
.split(/[\/\\]+/g)
69-
.map((p) => p.trim())
7069
.filter((p) => p !== "" && p !== ".")
7170
.reduce((slice, p) => {
7271
if (p === "..") {

server/routing.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export function toRouteRegExp(config: string | RoutesConfig): RouteRegExp {
9797
exec: (filename: string): URLPatternInput | null => {
9898
if (reg.test(filename)) {
9999
const parts = util.splitPath(util.trimPrefix(filename, prefix)).map((part) => {
100-
part = part.toLowerCase();
101100
// replace `/p/[...path]` to `/p/:path+`
102101
if (part.startsWith("[...") && part.startsWith("]") && part.length > 5) {
103102
return ":" + part.slice(4, -1) + "+";

0 commit comments

Comments
 (0)