From: Hu Hailin Date: Mon, 7 Aug 2006 16:17:50 +0000 (+0000) Subject: ->req->path has no leading /, which bites me so many times... X-Git-Tag: v0.05^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Plugin-Session-State-Cookie.git;a=commitdiff_plain;h=91e4fe2d76c8198894f01c4e4de03c6fb1fb7d42 ->req->path has no leading /, which bites me so many times... --- diff --git a/lib/Catalyst/Plugin/Session/State/Cookie.pm b/lib/Catalyst/Plugin/Session/State/Cookie.pm index a87ccc8..9cd6a46 100644 --- a/lib/Catalyst/Plugin/Session/State/Cookie.pm +++ b/lib/Catalyst/Plugin/Session/State/Cookie.pm @@ -49,7 +49,7 @@ sub cookie_is_rejecting { my ( $c, $cookie ) = @_; if ( $cookie->{path} ) { - return 1 if index $c->request->path, $cookie->{path}; + return 1 if index '/'.$c->request->path, $cookie->{path}; } return 0; diff --git a/t/basic.t b/t/basic.t index 843ff26..ec5e4c7 100644 --- a/t/basic.t +++ b/t/basic.t @@ -78,7 +78,7 @@ $req->clear; can_ok( $m, "cookie_is_rejecting" ); %req_cookies = ( path => '/foo' ); -$req->set_always( path => '/' ); +$req->set_always( path => '' ); ok( $cxt->cookie_is_rejecting(\%req_cookies), "cookie is rejecting" ); -$req->set_always( path => '/foo/bar' ); +$req->set_always( path => 'foo/bar' ); ok( !$cxt->cookie_is_rejecting(\%req_cookies), "cookie is not rejecting" );