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.
pull/334/head
Axel Burri 2020-03-07 00:24:45 +01:00
parent 936f88a68f
commit c11ab1507d
1 changed files with 4 additions and 4 deletions

8
btrbk
View File

@ -2446,9 +2446,10 @@ sub vinfo($$)
}
}
# Note that PATH and URL have no trailing slash, except if "/".
return {
HOST => $host, # hostname|<undef>
PORT => $port, # port|<undef>
HOST => $host, # hostname|<undef>
PORT => $port, # port|<undef>
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},