-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
CORS middleware only handles parameterized URLs with letters #647
Comments
I'm running into this issue too. My user ids are UUID4 which contain multiple hyphens. |
Am I mistaken that this issue might be resolved now via #642 >v2.4.1 |
@CrackerJackMack Partly, but not in a good enough way imo: In the monkeypatched middleware I use I have this instead of line 132 in hug/middleware.py
This allows for ids containing e.g. @ to be used in the url. It also allows anything else... |
I've added your solution and deployed a new version of Hug, Thanks! ~Timothy |
I love hug and use it a lot, and I ran into a problem today.
Say that I have a hug API like this:
The hug API answers to POST requests and the CORS middleware then answers to OPTIONS calls (pre-flighted requests):
If I however have ids with special characters that I want to use, this leads to errors:
The error on the server is this:
No match had been made and this is due to the regex here. It replaces all parameter placeholders in url routes with the regex
\w+
meaning that parameter values with characters other than[a-zA-Z0-9_]
will create an error. In my opinion I would like the replacing regex for route matching to be something like[\w.\-~!$&'()*+,;=:@]+
.I will draft a PR if you deem this to be a bug, but I want to ask if there was a reason for not having such a matching before I do.
Thank you once more for a fantastic framework!
The text was updated successfully, but these errors were encountered: