diff --git a/shared/jekyll_import.py b/shared/jekyll_import.py
index e744052aeb80fa50ff9545b0bc257f1b73b5f793..5d8194b9ccf6574ccfbed84fa09569cde083c752 100644
--- a/shared/jekyll_import.py
+++ b/shared/jekyll_import.py
@@ -179,16 +179,16 @@ def get_or_create_image(
             )
             return None, log_message
 
-        file = ImageFile(open(img_path, "rb"), name=img_path)
-        image = Image(title=file_path, file=file, collection=collection)
+    file = ImageFile(open(img_path, "rb"), name=img_path)
+    image = Image(title=file_path, file=file, collection=collection)
 
-        try:
-            image.save()
-        except Exception as e:
-            msg = "Nelze uložit obrázek"
-            logger.warning(msg, extra={"exc": e})
-            return None, msg
-        return image, ""
+    try:
+        image.save()
+    except Exception as e:
+        msg = "Nelze uložit obrázek"
+        logger.warning(msg, extra={"exc": e})
+        return None, msg
+    return image, ""
 
 
 def get_path_and_repo_name(url: str, use_git: bool) -> (str, str):