maintainers/scripts/pluginupdate.py: filter invalid XML characters
This commit is contained in:
parent
a674525c99
commit
15373e4b9d
@ -17,6 +17,7 @@ import http
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@ -192,6 +193,11 @@ class RepoGitHub(Repo):
|
|||||||
with urllib.request.urlopen(commit_req, timeout=10) as req:
|
with urllib.request.urlopen(commit_req, timeout=10) as req:
|
||||||
self._check_for_redirect(commit_url, req)
|
self._check_for_redirect(commit_url, req)
|
||||||
xml = req.read()
|
xml = req.read()
|
||||||
|
|
||||||
|
# Filter out illegal XML characters
|
||||||
|
illegal_xml_regex = re.compile(b"[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F]")
|
||||||
|
xml = illegal_xml_regex.sub(b"", xml)
|
||||||
|
|
||||||
root = ET.fromstring(xml)
|
root = ET.fromstring(xml)
|
||||||
latest_entry = root.find(ATOM_ENTRY)
|
latest_entry = root.find(ATOM_ENTRY)
|
||||||
assert latest_entry is not None, f"No commits found in repository {self}"
|
assert latest_entry is not None, f"No commits found in repository {self}"
|
||||||
|
Loading…
Reference in New Issue
Block a user