use force_str on xml fragment (#44931)

This commit is contained in:
Emmanuel Cazenave 2020-07-08 10:18:09 +02:00
parent 91c57bd9ca
commit 88096a2eca
1 changed files with 2 additions and 2 deletions

View File

@ -15,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import xml.etree.ElementTree as ET
from django import template
from django.conf import settings
from django.utils.encoding import force_str
from django.utils.six.moves.urllib import parse as urlparse
register = template.Library()
@ -30,7 +30,7 @@ def is_coming_for(request):
next_url = request.GET.get('next')
else:
try:
authn_request = ET.fromstring(request.session['saml:authnRequest'])
authn_request = ET.fromstring(force_str(request.session['saml:authnRequest']))
next_url = authn_request.findall(
'{urn:oasis:names:tc:SAML:2.0:protocol}Extensions/{https://www.entrouvert.com/}next_url')[0].text
except (KeyError, IndexError):