mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Also check the files basename against the exclude pattern.
This commit is contained in:
parent
4eb1ae7853
commit
b976ac914d
2 changed files with 12 additions and 0 deletions
|
@ -109,6 +109,7 @@ void csync_exclude_destroy(CSYNC *ctx) {
|
|||
int csync_excluded(CSYNC *ctx, const char *path) {
|
||||
size_t i;
|
||||
const char *p;
|
||||
const char *bname = NULL;
|
||||
|
||||
if (! ctx->options.unix_extensions) {
|
||||
for (p = path; *p; p++) {
|
||||
|
@ -133,11 +134,16 @@ int csync_excluded(CSYNC *ctx, const char *path) {
|
|||
}
|
||||
|
||||
if (ctx->excludes->count) {
|
||||
bname = c_basename(path);
|
||||
for (i = 0; i < ctx->excludes->count; i++) {
|
||||
if (csync_fnmatch(ctx->excludes->vector[i], path, 0) == 0) {
|
||||
return 1;
|
||||
}
|
||||
if( bname && csync_fnmatch(ctx->excludes->vector[i], bname, 0) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
SAFE_FREE(bname);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,12 @@ START_TEST (check_csync_excluded)
|
|||
fail_unless(csync_excluded(csync, ".kde/share/config/kwin.eventsrc") == 0, NULL);
|
||||
fail_unless(csync_excluded(csync, ".kde4/cache-maximegalon/cache1.txt") == 1, NULL);
|
||||
fail_unless(csync_excluded(csync, ".mozilla/plugins") == 1, NULL);
|
||||
|
||||
/* test for finding patterns in subdirs. .beagle is defined as a pattern and has to
|
||||
* be found in top dir as well as in directories underneath. */
|
||||
fail_unless(csync_excluded(csync, ".beagle") == 1, NULL);
|
||||
fail_unless(csync_excluded(csync, "foo/.beagle") == 1, NULL);
|
||||
fail_unless(csync_excluded(csync, "bar/foo/.beagle") == 1, NULL);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
Loading…
Reference in a new issue