Skip to content

Commit

Permalink
Merge pull request #6 from stuaxo/patch-1
Browse files Browse the repository at this point in the history
Update byto.py
  • Loading branch information
Cygn authored Dec 13, 2020
2 parents e0d986f + fb944b8 commit 7d9652a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pulseaudio_dlna/plugins/dlna/pyupnpv2/byto.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
import re


def repair_xml(bytes):

def repair_xml(xml_bytes):
def strip_namespaces(match):
return 'xmlns{prefix}="{content}"'.format(
prefix=match.group(1) if match.group(1) else '',
content=match.group(2).strip(),
return b'xmlns%s="%s"' % (
match.group(1) if match.group(1) else b"",
match.group(2).strip(),
)

bytes = re.sub(
r'xmlns(:.*?)?="(.*?)"', strip_namespaces, bytes,
flags=re.IGNORECASE)
xml_bytes = re.sub(
b'xmlns(:.*?)?="(.*?)"', strip_namespaces, xml_bytes, flags=re.IGNORECASE
)

return bytes
return xml_bytes

0 comments on commit 7d9652a

Please sign in to comment.