diff options
author | Eric Wong <e@80x24.org> | 2021-02-10 07:38:39 -0100 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-10 19:21:39 +0000 |
commit | 9eb840de546dfe9b6c6aa1588f5bb8c0153c7d71 (patch) | |
tree | f2833dc1e0c0cd3eeaebdbf0832dd9783488cb30 /lib/PublicInbox/LeiExternal.pm | |
parent | 330190c8d934d32984620208764b21e539cf68ef (diff) | |
download | public-inbox-9eb840de546dfe9b6c6aa1588f5bb8c0153c7d71.tar.gz |
While '{' and '}' are rare in path names, somebody may still use them or deal with software which does (e.g. GNU arch).
Diffstat (limited to 'lib/PublicInbox/LeiExternal.pm')
-rw-r--r-- | lib/PublicInbox/LeiExternal.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/LeiExternal.pm b/lib/PublicInbox/LeiExternal.pm index 8a51afcb..6cc2e671 100644 --- a/lib/PublicInbox/LeiExternal.pm +++ b/lib/PublicInbox/LeiExternal.pm @@ -58,16 +58,17 @@ sub glob2re { $re_map{$p eq '\\' ? '' : do { if ($1 eq '[') { ++$in_bracket } elsif ($1 eq ']') { --$in_bracket } + elsif ($1 eq ',') { ++$qm } # no change $p = $1; }} // do { $p = $1; ($p eq '-' && $in_bracket) ? $p : (++$qm, "\Q$p") }!sge); # bashism (also supported by curl): {a,b,c} => (a|b|c) - $re =~ s/([^\\]*)\\\{([^,]*?,[^\\]*?)\\\}/ - (my $in_braces = $2) =~ tr!,!|!; - $1."($in_braces)"; - /sge; + $changes += ($re =~ s/([^\\]*)\\\{([^,]*,[^\\]*)\\\}/ + (my $in_braces = $2) =~ tr!,!|!; + $1."($in_braces)"; + /sge); ($changes - $qm) ? $re : undef; } |