From 88a72cfbc3a36859ad15c29ae6cc3c099231409c Mon Sep 17 00:00:00 2001
From: Alexander Schlemmer <alexander@mail-schlemmer.de>
Date: Wed, 5 Oct 2022 14:27:25 +0200
Subject: [PATCH] FIX: hotfix for problems with the missing --prefix option

---
 src/caoscrawler/crawl.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py
index ccad9447..06059ed1 100644
--- a/src/caoscrawler/crawl.py
+++ b/src/caoscrawler/crawl.py
@@ -1088,6 +1088,8 @@ def crawler_main(crawled_directory_path: str,
             if isinstance(elem, db.File):
                 # correct the file path:
                 # elem.file = os.path.join(args.path, elem.file)
+                if prefix is None:
+                    raise RuntimeError("No prefix set. Prefix must be set if files are used.")
                 if elem.path.startswith(prefix):
                     elem.path = elem.path[len(prefix):]
                 elem.file = None
-- 
GitLab