From 88096a2eca55cc052d6b7dd5813ba0c9981934de Mon Sep 17 00:00:00 2001 From: Emmanuel Cazenave Date: Wed, 8 Jul 2020 10:18:09 +0200 Subject: [PATCH] use force_str on xml fragment (#44931) --- src/authentic2_gnm/templatetags/gnm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/authentic2_gnm/templatetags/gnm.py b/src/authentic2_gnm/templatetags/gnm.py index 2983db4..f8a4ae5 100644 --- a/src/authentic2_gnm/templatetags/gnm.py +++ b/src/authentic2_gnm/templatetags/gnm.py @@ -15,9 +15,9 @@ # along with this program. If not, see . 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):