Skip parsing user agent if absent from request

main
Ben Busby 2021-06-16 10:37:33 -04:00
parent bcb1d8ecc9
commit b21b4f4f57
No known key found for this signature in database
GPG Key ID: 3B08611DF6E62ED2
1 changed files with 2 additions and 1 deletions

View File

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