From 559d6675032a6da015a01a481ceb5cad0ba3594b Mon Sep 17 00:00:00 2001
From: OndraRehounek <ondra.rehounek@seznam.cz>
Date: Thu, 24 Mar 2022 17:08:06 +0100
Subject: [PATCH] one more exception handled

---
 district/jekyll_import.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/district/jekyll_import.py b/district/jekyll_import.py
index 504c315e..755483c8 100644
--- a/district/jekyll_import.py
+++ b/district/jekyll_import.py
@@ -118,7 +118,7 @@ def import_post(path, file_path, parent, title_suffix, dry_run, repo_name):
         r = re.split(r"^---\s*$", f.read(), maxsplit=3, flags=re.MULTILINE)
     try:
         meta = yaml.safe_load(r[1])
-    except ScannerError:
+    except (ScannerError, ValueError):
         message_list.append(
             {"level": ERROR, "text": "Nevalidní yaml pro {}".format(path)}
         )
@@ -229,7 +229,7 @@ def get_or_create_image(path, file_path, collection, repo_name) -> Image or None
                 img_path = os.path.join(path, img_name)
                 try:
                     urllib.request.urlretrieve(img_url, img_path)
-                except (HTTPError, UnicodeEncodeError, InvalidURL):
+                except (HTTPError, UnicodeEncodeError, InvalidURL, IsADirectoryError):
                     message_list.append(
                         {
                             "level": WARNING,
-- 
GitLab