mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Account for User-Agent being non-existent, causing a TypeError (#11064)
* Account for User-Agent being non-existent, causing a TypeError * Actually fix case of no user-agent with last resort * Return es5 as last resort * Update __init__.py * Update __init__.py
This commit is contained in:
parent
02c3ea1917
commit
86e1d0f952
@ -579,8 +579,12 @@ def _is_latest(js_option, request):
|
|||||||
if js_option != 'auto':
|
if js_option != 'auto':
|
||||||
return js_option == 'latest'
|
return js_option == 'latest'
|
||||||
|
|
||||||
|
useragent = request.headers.get('User-Agent')
|
||||||
|
if not useragent:
|
||||||
|
return False
|
||||||
|
|
||||||
from user_agents import parse
|
from user_agents import parse
|
||||||
useragent = parse(request.headers.get('User-Agent'))
|
useragent = parse(useragent)
|
||||||
|
|
||||||
# on iOS every browser is a Safari which we support from version 10.
|
# on iOS every browser is a Safari which we support from version 10.
|
||||||
if useragent.os.family == 'iOS':
|
if useragent.os.family == 'iOS':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user