From: John Napiorkowski Date: Mon, 27 Jul 2015 14:22:23 +0000 (-0500) Subject: Merge branch 'master' of https://github.com/revmischa/catalyst-runtime into revmischa... X-Git-Tag: 5.90096~5^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=6ed75978febef041904175e1c319c2698568db28;hp=6a7446627ba16c6012f76e097132403dc9201af0 Merge branch 'master' of https://github.com/revmischa/catalyst-runtime into revmischa-master --- diff --git a/README.mkdn b/README.mkdn index 3fcff0a..74be19d 100644 --- a/README.mkdn +++ b/README.mkdn @@ -2094,6 +2094,8 @@ konobi: Scott McWhirter marcus: Marcus Ramberg +Mischa Spiegelmock + miyagawa: Tatsuhiko Miyagawa mgrimes: Mark Grimes diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 891b722..9398f71 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -1632,6 +1632,12 @@ sub uri_for { my $query = ''; + # remove and save fragment if there is one + my $fragment; + if ($args =~ s/(#.+)$//) { + $fragment = $1; + } + if (my @keys = keys %$params) { # somewhat lifted from URI::_query's query_form $query = '?'.join('&', map { @@ -1660,7 +1666,10 @@ sub uri_for { $base =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go; $args = encode_utf8 $args; $args =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go; - + + # re-attach fragment on the end of everything after adding params + $query .= $fragment if $fragment; + my $res = bless(\"${base}${args}${query}", $class); $res; } diff --git a/t/aggregate/unit_core_uri_for.t b/t/aggregate/unit_core_uri_for.t index 3318192..d3696a2 100644 --- a/t/aggregate/unit_core_uri_for.t +++ b/t/aggregate/unit_core_uri_for.t @@ -59,14 +59,11 @@ is( 'Plus is not encoded' ); -TODO: { - local $TODO = 'broken by 5.7008'; - is( - Catalyst::uri_for( $context, '/bar#fragment', { param1 => 'value1' } )->as_string, - 'http://127.0.0.1/foo/bar?param1=value1#fragment', - 'URI for path with fragment and query params' - ); -} +is( + Catalyst::uri_for( $context, '/bar#fragment', { param1 => 'value1' } )->as_string, + 'http://127.0.0.1/foo/bar?param1=value1#fragment', + 'URI for path with fragment and query params' +); # test with utf-8 is(