Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addLeadingSlash shoudl not add leading slash for optional parameter #14545

Open
4 of 15 tasks
dcharbonnier opened this issue Jan 31, 2025 · 0 comments
Open
4 of 15 tasks
Labels
needs triage This issue has not been looked into

Comments

@dcharbonnier
Copy link

dcharbonnier commented Jan 31, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Due to recent route change addLeadingSlash fail to detect leading slash
The path @Get('{/:optional}/test.js') is now mapped to /{/:optional}/test.js this fail to match the path
/test.js the leading slash is present but optional.
I can make a PR for this issue but this looks dependant of the adapter so it may break fastify.
pillarjs/path-to-regexp#344 (reply in thread)

Minimum reproduction code

https://codesandbox.io/p/devbox/sharp-gould-8xyrf9?file=%2Fsrc%2Fapp.controller.ts

Steps to reproduce

No response

Expected behavior

/fail2.js ans /test/fail2.js should both work

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

No response

Packages versions

│ ├── @nestjs/[email protected]
│ ├── @nestjs/[email protected]
│ ├── @nestjs/[email protected]
│ ├── @nestjs/[email protected]
│ ├── @nestjs/[email protected]
│ ├── @nestjs/[email protected]
│ ├── @nestjs/[email protected]

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@dcharbonnier dcharbonnier added the needs triage This issue has not been looked into label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

1 participant