From 2aed4f6d1f95d1927fb3ae19dd2398bda0afdc07 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Mon, 13 Jul 2020 13:36:12 +0200 Subject: [PATCH] Only query the dir_filter for directories --- PFERD/ilias/crawler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PFERD/ilias/crawler.py b/PFERD/ilias/crawler.py index e520a79..8250a8f 100644 --- a/PFERD/ilias/crawler.py +++ b/PFERD/ilias/crawler.py @@ -38,6 +38,12 @@ class IliasElementType(Enum): FORUM = "FORUM" EXTERNAL_LINK = "EXTERNAL_LINK" + def is_folder(self) -> bool: + """ + Returns whether this type is some kind of folder. + """ + return "FOLDER" in str(self.name) + IliasDirectoryFilter = Callable[[Path, IliasElementType], bool] @@ -167,7 +173,7 @@ class IliasCrawler: PRETTY.not_searching(entry.path, "forum") continue - if not self.dir_filter(entry.path, entry.entry_type): + if entry.entry_type.is_folder() and not self.dir_filter(entry.path, entry.entry_type): PRETTY.not_searching(entry.path, "user filter") continue