From 95e7b6fe5f41a8b91a7ef6ae55ed976177d64ae9 Mon Sep 17 00:00:00 2001 From: Kyomotoi <0w0@imki.moe> Date: Tue, 7 Mar 2023 15:35:56 +0800 Subject: =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E5=AF=B9=E6=B6=A9?= =?UTF-8?q?=E5=9B=BE=E5=8A=A8=E5=9B=BE=E7=9A=84=E6=A3=80=E6=B5=8B=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/setu/nsfw_checker.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ATRI/plugins/setu/nsfw_checker.py') diff --git a/ATRI/plugins/setu/nsfw_checker.py b/ATRI/plugins/setu/nsfw_checker.py index 53546f6..d7ad6e1 100644 --- a/ATRI/plugins/setu/nsfw_checker.py +++ b/ATRI/plugins/setu/nsfw_checker.py @@ -40,9 +40,13 @@ def prepare_image(img): return image -async def detect_image(url: str, max_size: int) -> float: +async def detect_image(url: str, max_size: int, disab_gif: bool) -> float: try: req = await request.get(url) + if itype := req.headers.get("Content-Type"): + if disab_gif and itype == "image/gif": + return 0 + except Exception: raise RequestError("Get info from download image failed!") -- cgit v1.2.3