From e4155140f1a6b48e5bd60ee2564a35dc5dd0ab49 Mon Sep 17 00:00:00 2001
From: Christoph Stahl <christoph.stahl@tu-dortmund.de>
Date: Sun, 6 Oct 2024 13:50:08 +0200
Subject: [PATCH] Fixed local index file generation

---
 syng/sources/s3.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/syng/sources/s3.py b/syng/sources/s3.py
index 49bc391..f2ce5e2 100644
--- a/syng/sources/s3.py
+++ b/syng/sources/s3.py
@@ -102,7 +102,9 @@ class S3Source(FileBasedSource):
                 if obj.object_name is not None and self.has_correct_extension(obj.object_name)
             ]
             if self.index_file is not None and not os.path.isfile(self.index_file):
-                os.makedirs(os.path.dirname(self.index_file), exist_ok=True)
+                index_dir = os.path.dirname(self.index_file)
+                if index_dir:
+                    os.makedirs(os.path.dirname(self.index_file), exist_ok=True)
 
                 with open(self.index_file, "w", encoding="utf8") as index_file_handle:
                     dump(file_list, index_file_handle)