-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1520 from pbiering/skip-broken-item
add option to skip broken item instead of throwing an exception
- Loading branch information
Showing
5 changed files
with
25 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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-2019 Unrud <[email protected]> | ||
# Copyright © 2017-2022 Unrud <[email protected]> | ||
# Copyright © 2024-2024 Peter Bieringer <[email protected]> | ||
# | ||
# 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 | ||
|
@@ -40,6 +41,7 @@ def __init__(self, storage_: "multifilesystem.Storage", path: str, | |
# Path should already be sanitized | ||
self._path = pathutils.strip_path(path) | ||
self._encoding = storage_.configuration.get("encoding", "stock") | ||
self._skip_broken_item = storage_.configuration.get("storage", "skip_broken_item") | ||
if filesystem_path is None: | ||
filesystem_path = pathutils.path_to_filesystem(folder, self.path) | ||
self._filesystem_path = filesystem_path | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
# Copyright © 2017-2022 Unrud <[email protected]> | ||
# Copyright © 2024-2024 Peter Bieringer <[email protected]> | ||
# | ||
# 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 | ||
|
@@ -101,8 +102,12 @@ def _get(self, href: str, verify_href: bool = True | |
cache_content = self._store_item_cache( | ||
href, temp_item, cache_hash) | ||
except Exception as e: | ||
raise RuntimeError("Failed to load item %r in %r: %s" % | ||
(href, self.path, e)) from e | ||
if self._skip_broken_item: | ||
logger.warning("Skip broken item %r in %r: %s", href, self.path, e) | ||
return None | ||
else: | ||
raise RuntimeError("Failed to load item %r in %r: %s" % | ||
(href, self.path, e)) from e | ||
# Clean cache entries once after the data in the file | ||
# system was edited externally. | ||
if not self._item_cache_cleaned: | ||
|