work around negotiator crash with Chrome's new Accept header

https://github.com/CottageLabs/negotiator/issues/6 . thanks for reporting @gregorlove!
pull/354/head
Ryan Barrett 2023-01-02 09:44:10 -08:00
rodzic 427cd917e0
commit 42853fadad
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -76,7 +76,11 @@ def redir(to):
# check conneg, serve AS2 if requested
accept = request.headers.get('Accept')
if accept:
negotiated = _negotiator.negotiate(accept)
try:
negotiated = _negotiator.negotiate(accept)
except ValueError:
# work around https://github.com/CottageLabs/negotiator/issues/6
negotiated = None
if negotiated:
type = str(negotiated.content_type)
if type in (CONTENT_TYPE_AS2, CONTENT_TYPE_AS2_LD):