btrbk: fix path sanitizer

Sanitize "/././" -> "/"
pull/409/head
Axel Burri 2021-07-24 14:33:32 +02:00
parent 2616028326
commit 2824668c0e
1 changed files with 2 additions and 3 deletions

3
btrbk
View File

@ -3899,8 +3899,7 @@ sub check_file($$;@)
return undef; return undef;
} }
if($sanitize) { if($sanitize) {
$file =~ s/\/+/\//g; # sanitize multiple slash $file =~ s/\/(\.?\/)+/\//g; # sanitize "//", "/./" -> "/"
$file =~ s/\/\.\//\//g; # sanitize "/./" -> "/"
$file =~ s/\/\.$/\//; # sanitize trailing "/." -> "/" $file =~ s/\/\.$/\//; # sanitize trailing "/." -> "/"
$file =~ s/\/$// unless($file eq '/'); # remove trailing slash $file =~ s/\/$// unless($file eq '/'); # remove trailing slash
} }