@@ -211,7 +211,7 @@ export default class MsiTarget extends Target {
211
211
// since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid
212
212
// https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix
213
213
let result = `<Component${ directoryId === null ? "" : ` Directory="${ directoryId } "` } >`
214
- result += `\n${ fileSpace } <File Name="${ fileName } " Source="$(var.appDir)${ path . sep } ${ packagePath } " ReadOnly="yes" KeyPath="yes"`
214
+ result += `\n${ fileSpace } <File Name="${ xmlAttr ( fileName ) } " Source="$(var.appDir)${ path . sep } ${ xmlAttr ( packagePath ) } " ReadOnly="yes" KeyPath="yes"`
215
215
const isMainExecutable = packagePath === `${ appInfo . productFilename } .exe`
216
216
if ( isMainExecutable ) {
217
217
result += ' Id="mainExecutable"'
@@ -224,7 +224,7 @@ export default class MsiTarget extends Target {
224
224
result += `>\n`
225
225
const shortcutName = commonOptions . shortcutName
226
226
if ( isCreateDesktopShortcut ) {
227
- result += `${ fileSpace } <Shortcut Id="desktopShortcut" Directory="DesktopFolder" Name="${ shortcutName } " WorkingDirectory="APPLICATIONFOLDER" Advertise="yes" Icon="${ this . iconId } "/>\n`
227
+ result += `${ fileSpace } <Shortcut Id="desktopShortcut" Directory="DesktopFolder" Name="${ xmlAttr ( shortcutName ) } " WorkingDirectory="APPLICATIONFOLDER" Advertise="yes" Icon="${ this . iconId } "/>\n`
228
228
}
229
229
230
230
const hasMenuCategory = commonOptions . menuCategory != null
@@ -233,8 +233,8 @@ export default class MsiTarget extends Target {
233
233
if ( hasMenuCategory ) {
234
234
dirs . push ( `<Directory Id="${ startMenuShortcutDirectoryId } " Name="ProgramMenuFolder:\\${ commonOptions . menuCategory } \\"/>` )
235
235
}
236
- result += `${ fileSpace } <Shortcut Id="startMenuShortcut" Directory="${ startMenuShortcutDirectoryId } " Name="${ shortcutName } " WorkingDirectory="APPLICATIONFOLDER" Advertise="yes" Icon="${ this . iconId } ">\n`
237
- result += `${ fileSpace } <ShortcutProperty Key="System.AppUserModel.ID" Value="${ this . packager . appInfo . id } "/>\n`
236
+ result += `${ fileSpace } <Shortcut Id="startMenuShortcut" Directory="${ startMenuShortcutDirectoryId } " Name="${ xmlAttr ( shortcutName ) } " WorkingDirectory="APPLICATIONFOLDER" Advertise="yes" Icon="${ this . iconId } ">\n`
237
+ result += `${ fileSpace } <ShortcutProperty Key="System.AppUserModel.ID" Value="${ xmlAttr ( this . packager . appInfo . id ) } "/>\n`
238
238
result += `${ fileSpace } </Shortcut>\n`
239
239
}
240
240
result += `${ fileSpace } </File>`
@@ -255,7 +255,7 @@ export default class MsiTarget extends Target {
255
255
item . description ? `Description="${ item . description } "` : ""
256
256
} >\n`
257
257
result += `${ fileSpace } <Extension Id="${ ext } " Advertise="yes">\n`
258
- result += `${ fileSpace } <Verb Id="open" Command="Open with ${ this . packager . appInfo . productName } " Argument=""%1""/>\n`
258
+ result += `${ fileSpace } <Verb Id="open" Command="Open with ${ xmlAttr ( this . packager . appInfo . productName ) } " Argument=""%1""/>\n`
259
259
result += `${ fileSpace } </Extension>\n`
260
260
result += `${ fileSpace } </ProgId>\n`
261
261
}
@@ -273,3 +273,12 @@ function listToString(list: Array<string>, indentLevel: number) {
273
273
const space = " " . repeat ( indentLevel * 2 )
274
274
return list . join ( `\n${ space } ` )
275
275
}
276
+
277
+ function xmlAttr ( str : string ) {
278
+ return str
279
+ . replace ( / & / g, "&" )
280
+ . replace ( / < / g, "<" )
281
+ . replace ( / > / g, ">" )
282
+ . replace ( / " / g, """ )
283
+ . replace ( / ' / g, "'" )
284
+ }
0 commit comments