From b603acf89f76b587089a6f3827962bdd2e099b83 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 9 Jun 2024 11:13:38 +0200 Subject: [PATCH 1/2] extend --- radicale/storage/multifilesystem/verify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radicale/storage/multifilesystem/verify.py b/radicale/storage/multifilesystem/verify.py index d25d4fe7..2326832a 100644 --- a/radicale/storage/multifilesystem/verify.py +++ b/radicale/storage/multifilesystem/verify.py @@ -1,7 +1,8 @@ # This file is part of Radicale - CalDAV and CardDAV server # Copyright © 2014 Jean-Marc Martins # Copyright © 2012-2017 Guillaume Ayoub -# Copyright © 2017-2018 Unrud +# Copyright © 2017-2021 Unrud +# Copyright © 2024-2024 Peter Bieringer # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From a07b39eaada7f8b7edffb3b2debed623499bd423 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 9 Jun 2024 11:14:51 +0200 Subject: [PATCH 2/2] check/detect whether path is a collection, adjust/extend logging --- radicale/storage/multifilesystem/verify.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/radicale/storage/multifilesystem/verify.py b/radicale/storage/multifilesystem/verify.py index 2326832a..776f1bfd 100644 --- a/radicale/storage/multifilesystem/verify.py +++ b/radicale/storage/multifilesystem/verify.py @@ -49,7 +49,9 @@ class StoragePartVerify(StoragePartDiscover, StorageBase): while remaining_sane_paths: sane_path = remaining_sane_paths.pop(0) path = pathutils.unstrip_path(sane_path, True) - logger.debug("Verifying collection %r", sane_path) + logger.info("Verifying path %r", sane_path) + count = 0 + is_collection = True with exception_cm(sane_path, None): saved_item_errors = item_errors collection: Optional[storage.BaseCollection] = None @@ -60,6 +62,9 @@ class StoragePartVerify(StoragePartDiscover, StorageBase): assert isinstance(item, storage.BaseCollection) collection = item collection.get_meta() + if not collection.tag: + is_collection = False + logger.info("Skip !collection %r", sane_path) continue if isinstance(item, storage.BaseCollection): has_child_collections = True @@ -69,13 +74,17 @@ class StoragePartVerify(StoragePartDiscover, StorageBase): item.href, sane_path, item.uid) else: uids.add(item.uid) - logger.debug("Verified item %r in %r", - item.href, sane_path) + count += 1 + logger.debug("Verified in %r item %r", + sane_path, item.href) assert collection if item_errors == saved_item_errors: - collection.sync() + if is_collection: + collection.sync() if has_child_collections and collection.tag: logger.error("Invalid collection %r: %r must not have " "child collections", sane_path, collection.tag) + if is_collection: + logger.info("Verified collect %r (items: %d)", sane_path, count) return item_errors == 0 and collection_errors == 0