Decode urls in XML (fix #26)
This commit is contained in:
parent
f09b070e40
commit
056dec5819
@ -32,6 +32,15 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
# Python 2.6 has no OrderedDict, use a dict instead
|
# Python 2.6 has no OrderedDict, use a dict instead
|
||||||
OrderedDict = dict # pylint: disable=C0103
|
OrderedDict = dict # pylint: disable=C0103
|
||||||
|
|
||||||
|
# Manage Python2/3 different modules
|
||||||
|
# pylint: disable=F0401,E0611
|
||||||
|
try:
|
||||||
|
from urllib.parse import unquote
|
||||||
|
except ImportError:
|
||||||
|
from urllib import unquote
|
||||||
|
# pylint: enable=F0401,E0611
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
@ -458,9 +467,9 @@ def report(path, xml_request, collection):
|
|||||||
# Read rfc4791-7.9 for info
|
# Read rfc4791-7.9 for info
|
||||||
base_prefix = config.get("server", "base_prefix")
|
base_prefix = config.get("server", "base_prefix")
|
||||||
hreferences = set(
|
hreferences = set(
|
||||||
href_element.text[len(base_prefix):] for href_element
|
unquote(href_element.text)[len(base_prefix):] for href_element
|
||||||
in root.findall(_tag("D", "href"))
|
in root.findall(_tag("D", "href"))
|
||||||
if href_element.text.startswith(base_prefix))
|
if unquote(href_element.text).startswith(base_prefix))
|
||||||
else:
|
else:
|
||||||
hreferences = (path,)
|
hreferences = (path,)
|
||||||
# TODO: handle other filters
|
# TODO: handle other filters
|
||||||
|
Loading…
Reference in New Issue
Block a user