allow_path_info and single / #8

Open
melo opened this Issue May 4, 2012 · 5 comments

Projects

None yet

2 participants

@melo
Collaborator
melo commented May 4, 2012

If I have a component in the root of my site named foo with allow_path_info enabled, the following URLs match:

  • /foo: gives me an empty path info;
  • /foo/something: gives me something as path info.

This URL does not match:

  • /foo/

I think it should and path_info should be '/'.

Thoughts?

@jonswar
Owner
jonswar commented Jul 11, 2012

Hey Pedro,

Just wanted to thank you for your Mason feedback and contributions, and apologize for the delay in responding to/adopting them. That is not the way I normally like to treat contributors...

I'm now finally unburying myself after a particularly busy season at work and working chronologically through my email backlog. Currently at January :), but moving forward.

Best
Jon

@jonswar
Owner
jonswar commented Jul 11, 2012

On May 4, 2012, at 6:01 AM, Pedro Melo wrote:

If I have a component in the root of my site named foo with allow_path_info enabled, the following URLs match:

  • /foo: gives me an empty path info;
  • /foo/something: gives me something as path info.

This URL does not match:

  • /foo/

I think it should and path_info should be '/'.

It should certainly match. Not sure about path_info, in particular not sure whether trailing slashes should be automatically cleaned up from path_info. Should Mason in general treat path /foo/bar/ the same as /foo/bar?

@melo
Collaborator
melo commented Jul 11, 2012

Jonathan, no worries about the delays :)

Although I would personally choose to treat /foo/bar/ the same as /foo/bar, I also admit that it is because I'm biased to think in terms of mapping URLs to filesystems.

They are not the same URL, although years of automatic redirects by Apache and nginx from one to the other have trained us to think of them as the same.

I would keep path_info => '/' because it would allow each developer to decide if they are the same or not. Usually I like opinionated frameworks, but only if they let me choose my wrong way, if I really really need it.

@jonswar
Owner
jonswar commented Jul 11, 2012

Hmmm. I think that ignoring trailing slashes is probably the vast common case, so I don't want to require more work for that case. Maybe it can ignore them by default but provide an option to expose them...

@melo
Collaborator
melo commented Jul 11, 2012

Sure, that works too

@melo melo added a commit to melo/perl-mason that referenced this issue Jan 7, 2013
@melo melo Add two new test cases that should match
One of them, /foo/, fails right now, due to the fix for #8.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
09e9980
@melo melo added a commit to melo/perl-mason that referenced this issue Jan 7, 2013
@melo melo Redo fix for #8, respecting the index matches without allow_path_info
Signed-off-by: Pedro Melo <melo@simplicidade.org>
2a58680
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment