-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
🐛 [Bug]: Potential issues with parameter parsing in findNextParamPosition and handling of routes with multiple :
#3289
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
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
these codes were created as a solution to the problem with these PR google Custom methods With these cases Lines 43 to 72 in 25e3992
if you have ideas on how this parsing can be optimized, please create a PR |
Hey @ReneWerner87 sir, here is an mr for this fix pls look into it |
Bug Description
Hi Fiber team,
I’ve noticed two potential issues in the route-parsing logic:
The branch is main. fiber v3.
The condition if len(pattern) > nextParamPosition { break } appears to render the loop meaningless. Because nextParamPosition is guaranteed to be < len(pattern), the loop will always break after one iteration, which doesn’t seem to match the intended logic of skipping multiple consecutive : or similar parameter characters.
If I register GET("/a:::"), tools like Express Route Tester treat it as a purely static route. However, Fiber currently interprets the final : as a parameter indicator. This creates an inconsistency with other routing systems where multiple : characters at the end might be interpreted as part of a static path or simply invalid syntax.
Could you clarify if this is the intended behavior? If not, might it be possible to update the logic in findNextParamPosition (and related parsing code) so that multiple consecutive : are handled more consistently, and routes like "/a:::" are treated as static?
Thank you for your time and for all your work on Fiber!
How to Reproduce
skip
Expected Behavior
skip
Fiber Version
v3 main
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: