From 0e302a65b5269985cfad607f7d609487d27a3dae Mon Sep 17 00:00:00 2001 From: Kevin F Date: Sun, 3 Oct 2021 23:12:42 +0000 Subject: [PATCH] append jpg if there isnt one for single image --- imgin/__init__.py | 3 ++- imgin/get.py | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/imgin/__init__.py b/imgin/__init__.py index 38ad481..614cd7c 100644 --- a/imgin/__init__.py +++ b/imgin/__init__.py @@ -60,7 +60,8 @@ def gallery(id=''): @route('/') def hello(img=''): - + if img.endswith("jpeg") and not img.endswith("jpg") and not img.endswith("png"): + img += ".jpg" if not path.exists(IMAGE_CACHE + img): get(img, IMAGE_CACHE) return static_file(img, root=IMAGE_CACHE) diff --git a/imgin/get.py b/imgin/get.py index 738ad44..03631f2 100644 --- a/imgin/get.py +++ b/imgin/get.py @@ -34,9 +34,6 @@ def get(url: str, write_dir: str, delete=True): album = True if not url.endswith("blog"): url += "/layout/blog" - else: - if url.endswith("jpeg") and not url.endswith("jpg") and not url.endswith("png"): - url += ".jpg" if not album: