diff --git a/src/snek/system/template.py b/src/snek/system/template.py index 6460ff1..fa8a749 100644 --- a/src/snek/system/template.py +++ b/src/snek/system/template.py @@ -181,12 +181,12 @@ def enrich_image_rendering(text): soup = BeautifulSoup(text, "html.parser") for element in soup.find_all("img"): if element.attrs["src"].startswith("/"): - element.attrs["src"] += "?width=240&height=240&format=webp" + element.attrs["src"] += "?width=240&height=240" picture_template = f''' - - {element.attrs[ + + {element.attrs[ ''' element.replace_with(BeautifulSoup(picture_template, "html.parser")) return str(soup) diff --git a/src/snek/view/channel.py b/src/snek/view/channel.py index 84ee2cd..90d7c59 100644 --- a/src/snek/view/channel.py +++ b/src/snek/view/channel.py @@ -1,5 +1,6 @@ import asyncio import mimetypes +from os.path import isfile from PIL import Image import pillow_heif.HeifImagePlugin @@ -17,7 +18,7 @@ class ChannelAttachmentView(BaseView): relative_url=relative_path ) - if not channel_attachment: + if not channel_attachment or not isfile(channel_attachment["path"]): return web.HTTPNotFound() original_format = mimetypes.guess_type(channel_attachment["path"])[0]