mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix pre-commit
This commit is contained in:
parent
3d3d6d6e22
commit
a059ff4bfd
1 changed files with 8 additions and 2 deletions
|
@ -5060,6 +5060,7 @@ def _remove_invalid_xmlns(xml_file):
|
|||
xml_tree = lxml.etree.parse(io.StringIO(modified_xml))
|
||||
return xml_tree
|
||||
|
||||
|
||||
def _encode_xmlns_url(match):
|
||||
"""
|
||||
Escape spaces in xmlns urls
|
||||
|
@ -5068,9 +5069,10 @@ def _encode_xmlns_url(match):
|
|||
xmlns = match.group(2)
|
||||
url = match.group(3)
|
||||
after_url = match.group(4)
|
||||
encoded_url = re.sub(r'\s+', '%20', url)
|
||||
encoded_url = re.sub(r"\s+", "%20", url)
|
||||
return f'{before_xmlns}{xmlns}="{encoded_url}"{after_url}'
|
||||
|
||||
|
||||
def _parse_xml(adm_file):
|
||||
"""
|
||||
Parse the admx/adml file. There are 3 scenarios (so far) that we'll likely
|
||||
|
@ -5118,7 +5120,11 @@ def _parse_xml(adm_file):
|
|||
raw = raw.decode(encoding)
|
||||
for line in raw.split("\r\n"):
|
||||
if 'xmlns="' in line:
|
||||
line = re.sub(r'(.*)(\bxmlns(?::\w+)?)\s*=\s*"([^"]+)"(.*)', _encode_xmlns_url, line)
|
||||
line = re.sub(
|
||||
r'(.*)(\bxmlns(?::\w+)?)\s*=\s*"([^"]+)"(.*)',
|
||||
_encode_xmlns_url,
|
||||
line,
|
||||
)
|
||||
if 'key="' in line:
|
||||
start = line.index('key="')
|
||||
q1 = line[start:].index('"') + start
|
||||
|
|
Loading…
Add table
Reference in a new issue