Skip to content

Commit

Permalink
fix(dmg): Escaping special characters in DMG entries (#5987)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-pedrosa committed Jun 26, 2021
1 parent 86a538b commit c368f62
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/dmg-builder/src/dmg.ts
Expand Up @@ -314,10 +314,11 @@ async function computeDmgEntries(specification: DmgOptions, volumePath: string,

const entryPath = c.path || `${packager.appInfo.productFilename}.app`
const entryName = c.name || path.basename(entryPath)
const escapedEntryName = entryName.replace(/['\\]/g, match => `\\${match}`)
if (result.length !== 0) {
result += ",\n"
}
result += `'${entryName}': (${c.x}, ${c.y})`
result += `'${escapedEntryName}': (${c.x}, ${c.y})`

if (c.type === "link") {
asyncTaskManager.addTask(exec("ln", ["-s", `/${entryPath.startsWith("/") ? entryPath.substring(1) : entryPath}`, `${volumePath}/${entryName}`]))
Expand Down

0 comments on commit c368f62

Please sign in to comment.