-
Notifications
You must be signed in to change notification settings - Fork 31
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
route_param and dot in parameter #14
Comments
please confirm you do not have such an error with latest Raisin from master branch. thanks |
problem persists. This is due to _rep_regex() expects that path do not contains dots and slashes '[^/.]+' at https://github.com/khrt/Raisin/blob/master/lib/Raisin/Routes/Endpoint.pm#L68 |
ok, I understood, I had thought the problem was in a |
i fixed it but it looks like a temporary solution. thanks a lot for the report. |
Bug was reintroduced. Now it returns 406 error for parameters with dots. |
@vlet, unfortunately I don't know how to fix it right now. After introducing a Formatter middleware the logic has been changed a bit. Previously the cause of the issue was in Router, it hadn't been finding the endpoint because the part of the URI after the full stop wasn't involved in the matching. Now Router finds any routes, but Formatter splits the URI by fullstops and considers the last part as a format; it throws an 406 error in case encoder is not found, which is happening in your case. You can try to avoid this behaviour specifying the proper extension with the latest master branch, like $ curl 'http://0:5000/user.name.json'
["hello","user.name"] It's a workaround until I can come with a better solution. |
Ok, thanks |
Hi, we also stumbled upon this issue. I was able to follow it down to If there is a dot "." anywhere in the entire path the remainder of the path is considered an "extension", even if there are slashes following the dot, e.g.: $ curl --noproxy \* -i http://localhost:5000/check/D.a/all
HTTP/1.0 406 Not Acceptable
Date: Tue, 27 Apr 2021 17:24:21 GMT
Server: HTTP::Server::PSGI
Content-Length: 0
The unfortunate magic happens in @@ -71,6 +73,8 @@ sub call {
sub _accept_header_set { length(shift || '') }
sub _path_has_extension {
my $path = shift;
+ my $idx_last_slash = rindex $path, '/';
+ $path = $idx_last_slash >= 0 ? substr $path, $idx_last_slash : $path;
my @chunks = split /\./, $path;
scalar(@chunks) > 1;
} This would solve my current problem. But it should (somehow) be checked if this "extension" can be handled properly? |
Do not interpret "." in path names as a file extension.
Do not interpret "." in path names as a file extension.
Parameters captured by
route_param
can't contain dots.For example, route '/:name'
This is ok
but this isn't
The text was updated successfully, but these errors were encountered: