Preserve leading slash context for absolute double-star filters

This commit is contained in:
Andrea Mazzoleni 2026-08-26 20:06:26 +02:00
parent fcb6a5ca91
commit fa81c20ee6
4 changed files with 170 additions and 7 deletions

View file

@ -247,8 +247,8 @@ static int filter_apply(struct snapraid_filter* filter, struct snapraid_filter**
int ret = 0;
if (filter->is_abs) {
/* skip initial slash, as always missing in the path */
if (wnmatch_sub(filter->pattern + 1, path, match_sub) == 0)
/* preserve the skipped slash because it gives an initial ** its recursive meaning */
if (wnmatch_sub_prev(filter->pattern + 1, path, match_sub, '/') == 0)
ret = filter->direction;
} else {
/* the path is relative, first try to match from the root */