From 61cc1ddcb7290d4fdcc9809d66202483327c2376 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Fri, 28 Oct 2022 20:52:19 -0500 Subject: [PATCH] inline is_image --- files/classes/submission.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 27dfdea36..0946e2e41 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -398,9 +398,7 @@ class Submission(Base): @property @lazy def is_image(self): - if self.url and (self.url.lower().endswith('.webp') or self.url.lower().endswith('.jpg') or self.url.lower().endswith('.png') or self.url.lower().endswith('.gif') or self.url.lower().endswith('.jpeg') or self.url.lower().endswith('?maxwidth=9999') or self.url.lower().endswith('&fidelity=high')) and is_safe_url(self.url): - return True - return False + return self.url and any((self.url.lower().endswith(x) for x in ('.webp','.jpg','.png','.gif','.jpeg','?maxwidth=9999','&fidelity=high'))) and is_safe_url(self.url) @lazy def filtered_flags(self, v):