Skip to content

Commit

Permalink
fix xml Entity References in manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
SmittyWerbenJJ committed Apr 10, 2023
1 parent 3e63e9b commit 802766c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mkdim/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def getRootDirs():
]
return [str(x).casefold() for x in dirs]

def fix_xml_reference(string):
return string.replace("<","&lt;").replace(">","&gt;").replace('"',"&quot;").replace("&","&amp;").replace("'","&apos;")

def getImageSuffixes():
return [
Expand All @@ -40,7 +42,7 @@ def __init__(self, sourcePath:Path, manifestPath:Path) -> None:
class Manifest:
header = '<DAZInstallManifest VERSION="0.1">'
id_template='<GlobalID VALUE="{}" />'
content_template='\t<File TARGET="Content" ACTION="Install" VALUE="{}" />'
content_template=' <File TARGET="Content" ACTION="Install" VALUE="{}" />'
footer='</DAZInstallManifest>'
supportDir=Path("Content/Runtime/Support/")

Expand Down Expand Up @@ -138,6 +140,6 @@ def toString(self):
lines=[self.header,self.id_template.format(guid)]

for entry in self.entries:
lines.append(self.content_template.format(entry.manifestPath))
lines.append(self.content_template.format(fix_xml_reference(entry.manifestPath.as_posix())))
lines.append(self.footer)
return "\n".join(lines)

0 comments on commit 802766c

Please sign in to comment.