append jpg if there isnt one for single image

This commit is contained in:
Kevin F 2021-10-03 23:12:42 +00:00
parent bd532c6c66
commit 0e302a65b5
2 changed files with 2 additions and 4 deletions

View File

@ -60,7 +60,8 @@ def gallery(id=''):
@route('/<img>')
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)

View File

@ -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: