Skip to content

Commit

Permalink
Fix parsing URIs with empty path segments
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbkr committed Jul 19, 2024
1 parent c70029f commit b8fb5ca
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/Cro/Uri.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -250,24 +250,21 @@ class Cro::Uri does Cro::ResourceIdentifier {

method path-abempty($/) {
my $result = '';
for @$<segment> {
$result ~= '/';
$result ~= $_.ast with $_<pchars>;
}
$result ~= '/' ~ ($_<pchars> ?? $_<pchars>.ast !! '') for @$<segment>;
make $result;
}

method path-absolute($/) {
my $result = '/';
$result ~= $_<pchars>.ast with $<segment-nz>;
$result ~= '/' ~ $_<pchars>.ast for @$<segment>;
$result ~= '/' ~ ($_<pchars> ?? $_<pchars>.ast !! ~$_) for @$<segment>;
make $result;
}

method path-rootless($/) {
my $result = '';
$result ~= $_.ast with $<segment-nz>;
$result ~= '/' ~ $_<pchars>.ast for @$<segment>;
$result ~= '/' ~ ($_<pchars> ?? $_<pchars>.ast !! ~$_) for @$<segment>;
make $result;
}

Expand Down

0 comments on commit b8fb5ca

Please sign in to comment.