From de09f6689a22fe6b2845411520f1fe5c22c31877 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 4 Sep 2016 13:16:42 +0200 Subject: [PATCH] Only relevant files for last_modified calculation Leftovers from failed transactions etc. should not change that property. --- radicale/storage.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/radicale/storage.py b/radicale/storage.py index 9b4fd77..f8f75d3 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -686,9 +686,12 @@ class Collection(BaseCollection): @property def last_modified(self): - last = max([os.path.getmtime(self._filesystem_path)] + [ - os.path.getmtime(os.path.join(self._filesystem_path, filename)) - for filename in os.listdir(self._filesystem_path)] or [0]) + relevant_files = [self._filesystem_path] + [ + path_to_filesystem(self._filesystem_path, href) + for href in self.list()] + if os.path.exists(self._props_path): + relevant_files.append(self._props_path) + last = max(map(os.path.getmtime, relevant_files)) return time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(last)) def serialize(self):