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
Trailing slash in resource routes doesn't work #204
Comments
Oh, I had thought this was fixed, but what I fixed was double-slashes. |
Fixed in c2e664a -- will strip the slash when trying to match a route, but if a route isn't found, will first check if the path is a directory, and look for a an index file. (Some people have the idea that the path "foo/" implies a directory.) Eventually I guess the name of the index file could be configurable. |
hello, I installed a fresh geddy but it seems the trailing slash isn't working : |
While stripping the trailing slash might not actually be the best idea, I feel pretty strongly that having my_dir and my_dir/ be two different resources is a bad idea from a practical standpoint. Correct behavior with respect to the trailing slash isn't spelled out in any RFC from what I've seen, but RFC 3986 only mentions it in the Equivalence section as an example of two URLs that are likely to be the same: http://tools.ietf.org/html/rfc3986#section-6.2.4 Other online resources advocate always including the trailing slash, and assuming that anything without an extension is a directory. That seems like advice that might be a little dated in the age of Web apps -- an URL simply represents a resource in the app, and doesn't necessarily map to anything on the filesystem. |
I totally agree with you that having two different ressources having the same name, with and without trailing slash, is ambiguous, notably for crawlers, and not essential really, and uri are just resources identifiers that not necesserily reflect any filesystem, so forget my last sentence saying "it would be possible...".
|
I agree, modifying the resource to strip the slash might not be the best Right now we normalize the incoming URL -- perhaps we could also normalize On Tue, Dec 3, 2013 at 3:09 PM, David MARTIN notifications@github.comwrote:
|
Maybe yes, what do you mean by normalize route ? but at least it can alerted that trailing slash are not supported when declaring routes. I had some little convention :
This explains why I like trailing slash. So it can work without controller if wished, for say "static" content, then I also set some routes but only for views needing operations / controller. |
You're absolutely right -- what we have now is clearly a bug, because it allows you to define a route that looks legitimate, but will never match anything. At bare minimum we should throw some sort of error in this case. I believe I understand all the points in your conventions, although Geddy doesn't follow the underscore convention for partials, since we don't yet make any of them available for request directly. I've always found it weird that Rails would name partials with a leading underscore, but you leave out the underscore when rendering with the |
I've opened an Issue for this problem with the trailing slash in routes: #508 |
cool ! well maybe "bug" is a bit high but yes some warning would be nice ;-) Anyways Geddy is cool, particulary the data bridge/interface and sessions, and server javascript just rocks ! |
"host/controller/" doesn't work as "host/controller"
@kieran suggested (here) to remove the trailing slash before it hits the router.
The text was updated successfully, but these errors were encountered: