File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -5060,6 +5060,7 @@ def _remove_invalid_xmlns(xml_file):
5060
5060
xml_tree = lxml .etree .parse (io .StringIO (modified_xml ))
5061
5061
return xml_tree
5062
5062
5063
+
5063
5064
def _encode_xmlns_url (match ):
5064
5065
"""
5065
5066
Escape spaces in xmlns urls
@@ -5068,9 +5069,10 @@ def _encode_xmlns_url(match):
5068
5069
xmlns = match .group (2 )
5069
5070
url = match .group (3 )
5070
5071
after_url = match .group (4 )
5071
- encoded_url = re .sub (r' \s+' , ' %20' , url )
5072
+ encoded_url = re .sub (r" \s+" , " %20" , url )
5072
5073
return f'{ before_xmlns } { xmlns } ="{ encoded_url } "{ after_url } '
5073
5074
5075
+
5074
5076
def _parse_xml (adm_file ):
5075
5077
"""
5076
5078
Parse the admx/adml file. There are 3 scenarios (so far) that we'll likely
@@ -5118,7 +5120,11 @@ def _parse_xml(adm_file):
5118
5120
raw = raw .decode (encoding )
5119
5121
for line in raw .split ("\r \n " ):
5120
5122
if 'xmlns="' in line :
5121
- line = re .sub (r'(.*)(\bxmlns(?::\w+)?)\s*=\s*"([^"]+)"(.*)' , _encode_xmlns_url , line )
5123
+ line = re .sub (
5124
+ r'(.*)(\bxmlns(?::\w+)?)\s*=\s*"([^"]+)"(.*)' ,
5125
+ _encode_xmlns_url ,
5126
+ line ,
5127
+ )
5122
5128
if 'key="' in line :
5123
5129
start = line .index ('key="' )
5124
5130
q1 = line [start :].index ('"' ) + start
You can’t perform that action at this time.
0 commit comments