From 8a49a8c7dc0267ad3aa3fbb8ffd41807ffc5e52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20B=C3=B6ker?= Date: Fri, 19 Jul 2024 12:57:50 +0200 Subject: [PATCH] Fix parsing URIs with empty path segments Fixes croservices/cro-http#197, fixes #39. --- lib/Cro/Uri.pm6 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/Cro/Uri.pm6 b/lib/Cro/Uri.pm6 index 614b49c..ae665e6 100644 --- a/lib/Cro/Uri.pm6 +++ b/lib/Cro/Uri.pm6 @@ -250,24 +250,21 @@ class Cro::Uri does Cro::ResourceIdentifier { method path-abempty($/) { my $result = ''; - for @$ { - $result ~= '/'; - $result ~= $_.ast with $_; - } + $result ~= '/' ~ (.ast with $_) for @$; make $result; } method path-absolute($/) { my $result = '/'; $result ~= $_.ast with $; - $result ~= '/' ~ $_.ast for @$; + $result ~= '/' ~ (.ast with $_) for @$; make $result; } method path-rootless($/) { my $result = ''; $result ~= $_.ast with $; - $result ~= '/' ~ $_.ast for @$; + $result ~= '/' ~ (.ast with $_) for @$; make $result; }