bxo 0.0.5-dev.31 → 0.0.5-dev.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.ts +15 -9
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -340,7 +340,7 @@ export default class BXO {
340
340
  if (routeSegment === '*' && i === routeSegments.length - 1) {
341
341
  // Wildcard at end matches remaining path segments
342
342
  const remainingPath = pathSegments.slice(i).join('/');
343
- params['*'] = decodeURIComponent(remainingPath);
343
+ params['*'] = remainingPath;
344
344
  break;
345
345
  }
346
346
 
@@ -351,11 +351,11 @@ export default class BXO {
351
351
 
352
352
  if (routeSegment.startsWith(':')) {
353
353
  const paramName = routeSegment.slice(1);
354
- params[paramName] = decodeURIComponent(pathSegment);
354
+ params[paramName] = pathSegment;
355
355
  } else if (routeSegment === '*') {
356
356
  // Single segment wildcard
357
- params['*'] = decodeURIComponent(pathSegment);
358
- } else if (routeSegment !== decodeURIComponent(pathSegment)) {
357
+ params['*'] = pathSegment;
358
+ } else if (routeSegment !== pathSegment) {
359
359
  isMatch = false;
360
360
  break;
361
361
  }
@@ -404,7 +404,7 @@ export default class BXO {
404
404
  if (routeSegment === '*' && i === routeSegments.length - 1) {
405
405
  // Wildcard at end matches remaining path segments
406
406
  const remainingPath = pathSegments.slice(i).join('/');
407
- params['*'] = decodeURIComponent(remainingPath);
407
+ params['*'] = remainingPath;
408
408
  break;
409
409
  }
410
410
 
@@ -415,11 +415,11 @@ export default class BXO {
415
415
 
416
416
  if (routeSegment.startsWith(':')) {
417
417
  const paramName = routeSegment.slice(1);
418
- params[paramName] = decodeURIComponent(pathSegment);
418
+ params[paramName] = pathSegment;
419
419
  } else if (routeSegment === '*') {
420
420
  // Single segment wildcard
421
- params['*'] = decodeURIComponent(pathSegment);
422
- } else if (routeSegment !== decodeURIComponent(pathSegment)) {
421
+ params['*'] = pathSegment;
422
+ } else if (routeSegment !== pathSegment) {
423
423
  isMatch = false;
424
424
  break;
425
425
  }
@@ -510,7 +510,13 @@ export default class BXO {
510
510
  private async handleRequest(request: Request, server?: any): Promise<Response | undefined> {
511
511
  const url = new URL(request.url);
512
512
  const method = request.method;
513
- const pathname = url.pathname;
513
+ const rawPathname = url.pathname;
514
+ let pathname: string;
515
+ try {
516
+ pathname = decodeURI(rawPathname);
517
+ } catch {
518
+ pathname = rawPathname;
519
+ }
514
520
 
515
521
  // Check for WebSocket upgrade
516
522
  if (request.headers.get('upgrade') === 'websocket') {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bxo",
3
3
  "module": "index.ts",
4
- "version": "0.0.5-dev.31",
4
+ "version": "0.0.5-dev.32",
5
5
  "description": "A simple and lightweight web framework for Bun",
6
6
  "type": "module",
7
7
  "devDependencies": {