From dad9fd8904550b89d0cb2d4f255d0c4dbdfbb7f2 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Thu, 30 Mar 2017 22:46:54 +0200 Subject: [PATCH] Ignore directories with leading dot --- CHANGELOG.rst | 2 ++ vdirsyncer/storage/filesystem.py | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a468d46..3a34f5c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,8 @@ Version 0.16.0 - Fix crash of Google storages when saving token file. - Make DAV discovery more RFC-conformant, see :ghpr:`585`. - Vdirsyncer is now tested against Xandikos, see :ghpr:`601`. +- Subfolders with a leading dot are now ignored during discover for + ``filesystem`` storage. - Statuses are now stored in a sqlite database. Old data is automatically migrated. Users with really large datasets should encounter performance improvements. This means that **sqlite3 is now a dependency of vdirsyncer**. diff --git a/vdirsyncer/storage/filesystem.py b/vdirsyncer/storage/filesystem.py index fea644a..271c9a3 100644 --- a/vdirsyncer/storage/filesystem.py +++ b/vdirsyncer/storage/filesystem.py @@ -23,6 +23,9 @@ class FilesystemStorage(Storage): Can be used with `khal `_. See :doc:`vdir` for a more formal description of the format. + Directories with a leading dot are ignored to make usage of e.g. version + control easier. + :param path: Absolute path to a vdir/collection. If this is used in combination with the ``collections`` parameter in a pair-section, this should point to a directory of vdirs instead. @@ -72,10 +75,8 @@ class FilesystemStorage(Storage): def _validate_collection(cls, path): if not os.path.isdir(path): return False - for item in os.listdir(path): - item_path = os.path.join(path, item) - if os.path.isdir(item_path): - return False + if os.path.basename(path).startswith('.'): + return False return True @classmethod