Skip to content

Commit

Permalink
Update entity.py
Browse files Browse the repository at this point in the history
  • Loading branch information
earonesty committed Jan 25, 2023
1 parent 63b2288 commit eb01d81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/saml2/entity.py
Expand Up @@ -3,6 +3,7 @@
import copy
from hashlib import sha1
import logging
import zlib

import requests

Expand Down Expand Up @@ -444,7 +445,10 @@ def unravel(txt, binding, msgtype="response"):
if binding == BINDING_HTTP_REDIRECT:
xmlstr = decode_base64_and_inflate(txt)
elif binding == BINDING_HTTP_POST:
xmlstr = base64.b64decode(txt)
try:
xmlstr = decode_base64_and_inflate(txt)
except zlib.error:
xmlstr = base64.b64decode(txt)
elif binding == BINDING_SOAP:
func = getattr(soap, f"parse_soap_enveloped_saml_{msgtype}")
xmlstr = func(txt)
Expand Down

0 comments on commit eb01d81

Please sign in to comment.