From c11ab1507d66b1c0e69fc920fd62ba03e6bcf8eb Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sat, 7 Mar 2020 00:24:45 +0100 Subject: [PATCH] btrbk: sanitize url on PRINT For consistency with PATH and URL, $vol->{PRINT} was not sanitized (trailing "//" if parent is "/"). This is now dropped, as this is more confusing than useful. --- btrbk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/btrbk b/btrbk index 8d31c50..18ed45d 100755 --- a/btrbk +++ b/btrbk @@ -2446,9 +2446,10 @@ sub vinfo($$) } } + # Note that PATH and URL have no trailing slash, except if "/". return { - HOST => $host, # hostname| - PORT => $port, # port| + HOST => $host, # hostname| + PORT => $port, # port| NAME => $name, PATH => $path, PRINT => $print, @@ -2470,13 +2471,12 @@ sub vinfo_child($$;$) $subvol_dir = $1 if($name =~ s/^(.*)\///); # Note that PATH and URL intentionally contain "//" if $parent->{PATH} = "/". - # For consistency reasons (not required), we dont sanitize PRINT either. my $vinfo = { HOST => $parent->{HOST}, PORT => $parent->{PORT}, NAME => $name, PATH => "$parent->{PATH}/$rel_path", - PRINT => "$parent->{PRINT}/$rel_path", + PRINT => "$parent->{PRINT}" . ($parent->{PRINT} =~ /\/$/ ? "" : "/") . $rel_path, URL => "$parent->{URL}/$rel_path", URL_PREFIX => $parent->{URL_PREFIX}, MACHINE_ID => $parent->{MACHINE_ID},