From 8b065d61ce8b1276e608ba02f775893cda83bffe Mon Sep 17 00:00:00 2001 From: Ondrej Rehounek <ondra.rehounek@seznam.cz> Date: Thu, 7 Apr 2022 20:33:07 +0200 Subject: [PATCH] Fix image handler --- shared/jekyll_import.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/shared/jekyll_import.py b/shared/jekyll_import.py index e744052a..5d8194b9 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): -- GitLab