Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/Cro/Uri.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ class Cro::Uri does Cro::ResourceIdentifier {
method path-absolute($/) {
my $result = '/';
$result ~= $_<pchars>.ast with $<segment-nz>;
$result ~= '/' ~ (.ast with $_<pchars>) for @$<segment>;
for @$<segment> {
$result ~= '/' ~ $_<pchars>.ast if $_<pchars>;
}
make $result;
}

Expand Down Expand Up @@ -316,9 +318,16 @@ class Cro::Uri does Cro::ResourceIdentifier {
}

method relative-part($/) {
make $<authority>
if $/.orig.ends-with('/') {
make $<authority>
?? %( $<authority>.ast, path => $<path-abempty>.ast )
!! %( path => ($<path-absolute> || $<path-noscheme> || $<path-empty>).ast~'/' );
}
else {
make $<authority>
?? %( $<authority>.ast, path => $<path-abempty>.ast )
!! %( path => ($<path-absolute> || $<path-noscheme> || $<path-empty>).ast );
}
}

method path-noscheme($/) {
Expand Down