From b21b4f4f572f69cf3b5fb742113514a1f0a3a614 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Wed, 16 Jun 2021 10:37:33 -0400 Subject: [PATCH] Skip parsing user agent if absent from request --- app/request.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/request.py b/app/request.py index 6744fe2..68e30d8 100644 --- a/app/request.py +++ b/app/request.py @@ -157,7 +157,8 @@ class Request: self.language = ( config.lang_search if config.lang_search else '' ) - self.mobile = 'Android' in normal_ua or 'iPhone' in normal_ua + self.mobile = bool(normal_ua) and ('Android' in normal_ua + or 'iPhone' in normal_ua) self.modified_user_agent = gen_user_agent(self.mobile) if not self.mobile: self.modified_user_agent_mobile = gen_user_agent(True)