diff --git a/lib/Cro/Uri.rakumod b/lib/Cro/Uri.rakumod index 7ddfff4..ab0f816 100644 --- a/lib/Cro/Uri.rakumod +++ b/lib/Cro/Uri.rakumod @@ -263,7 +263,9 @@ class Cro::Uri does Cro::ResourceIdentifier { method path-absolute($/) { my $result = '/'; $result ~= $_.ast with $; - $result ~= '/' ~ (.ast with $_) for @$; + for @$ { + $result ~= '/' ~ $_.ast if $_; + } make $result; } @@ -316,9 +318,16 @@ class Cro::Uri does Cro::ResourceIdentifier { } method relative-part($/) { - make $ + if $/.orig.ends-with('/') { + make $ + ?? %( $.ast, path => $.ast ) + !! %( path => ($ || $ || $).ast~'/' ); + } + else { + make $ ?? %( $.ast, path => $.ast ) !! %( path => ($ || $ || $).ast ); + } } method path-noscheme($/) {