From 2dfbc2058fe172eb8abc96b71da33031fdc5adc1 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 10 Sep 2014 15:21:19 +0200 Subject: [PATCH] Win32: ignore files ending in '.' or at least one space Fixes #416 Fixes #2176 --- csync/src/csync_exclude.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/csync/src/csync_exclude.c b/csync/src/csync_exclude.c index 8567575948..583aabe219 100644 --- a/csync/src/csync_exclude.c +++ b/csync/src/csync_exclude.c @@ -199,6 +199,20 @@ CSYNC_EXCLUDE_TYPE csync_excluded_no_ctx(c_strlist_t *excludes, const char *path goto out; } +#ifdef _WIN32 + // Windows cannot sync files ending in spaces (#2176). It also cannot + // distinguish files ending in '.' from files without an ending, + // as '.' is a separator that is not stored internally, so let's + // not allow to sync those to avoid file loss/ambiguities (#416) + size_t blen = strlen(bname); + if (blen > 1 && (bname[blen-1]== ' ' || bname[blen-1]== '.' )) { + match = CSYNC_FILE_EXCLUDE_INVALID_CHAR; + SAFE_FREE(bname); + SAFE_FREE(dname); + goto out; + } +#endif + rc = csync_fnmatch(".owncloudsync.log*", bname, 0); if (rc == 0) { match = CSYNC_FILE_SILENTLY_EXCLUDED;