mirror of https://github.com/digint/btrbk
btrbk: bugfix: vinfo_match: skip match against invalid paths
Dont check url_regex if $vinfo->{URL} is not a valid path (e.g. when checking against a "volume" or "subvolume" having wildcards): "Use of uninitialized value in join or string" at line 3030pull/334/head
parent
c36890e1eb
commit
37b30caeb2
8
btrbk
8
btrbk
|
@ -3027,7 +3027,11 @@ sub vinfo_match($$;@)
|
||||||
my $vinfo = shift;
|
my $vinfo = shift;
|
||||||
my %opts = @_;
|
my %opts = @_;
|
||||||
my $flag_matched = $opts{flag_matched};
|
my $flag_matched = $opts{flag_matched};
|
||||||
my $url = join("", check_url($vinfo->{URL})); # sanitize URL (can contain "//", see vinfo_child)
|
|
||||||
|
# match URL against sane path (can contain "//", see vinfo_child),
|
||||||
|
# no wildcards
|
||||||
|
my ($url_prefix, $path) = check_url($vinfo->{URL});
|
||||||
|
my $url = defined($path) ? $url_prefix . $path : undef;
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
foreach my $ff (@$filter) {
|
foreach my $ff (@$filter) {
|
||||||
if(defined($ff->{group_eq}) && (grep { $ff->{group_eq} eq $_ } @{$vinfo->{CONFIG}{group}})) {
|
if(defined($ff->{group_eq}) && (grep { $ff->{group_eq} eq $_ } @{$vinfo->{CONFIG}{group}})) {
|
||||||
|
@ -3037,7 +3041,7 @@ sub vinfo_match($$;@)
|
||||||
$ff->{$flag_matched} = 1;
|
$ff->{$flag_matched} = 1;
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
if(defined($ff->{url_regex}) && ($url =~ /$ff->{url_regex}/)) {
|
if(defined($ff->{url_regex}) && defined($url) && ($url =~ /$ff->{url_regex}/)) {
|
||||||
TRACE "filter \"$ff->{unparsed}\" matches $vinfo->{CONFIG}{CONTEXT} url: $vinfo->{PRINT}";
|
TRACE "filter \"$ff->{unparsed}\" matches $vinfo->{CONFIG}{CONTEXT} url: $vinfo->{PRINT}";
|
||||||
return $ff unless($flag_matched);
|
return $ff unless($flag_matched);
|
||||||
#push @{$ff->{$flag_matched}}, $vinfo->{CONFIG}{CONTEXT} . '=' . $vinfo->{PRINT};
|
#push @{$ff->{$flag_matched}}, $vinfo->{CONFIG}{CONTEXT} . '=' . $vinfo->{PRINT};
|
||||||
|
|
Loading…
Reference in New Issue