Skip to content

Commit

Permalink
fix: trim the whole string, otherwise detection of windows-like path …
Browse files Browse the repository at this point in the history
…is not robust

Close #1596
  • Loading branch information
develar committed May 30, 2017
1 parent 381e8c0 commit e63e8fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/electron-builder/src/codeSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface CodeSigningInfo {
}

export async function downloadCertificate(urlOrBase64: string, tmpDir: TmpDir, currentDir: string): Promise<string> {
urlOrBase64 = urlOrBase64.trim()

let file: string | null = null
if ((urlOrBase64.length > 3 && urlOrBase64[1] === ":") || urlOrBase64.startsWith("/") || urlOrBase64.startsWith(".")) {
file = urlOrBase64
Expand Down Expand Up @@ -46,7 +48,7 @@ export async function downloadCertificate(urlOrBase64: string, tmpDir: TmpDir, c
}
}

file = path.resolve(currentDir, file.trim())
file = path.resolve(currentDir, file)
const stat = await statOrNull(file)
if (stat == null) {
throw new Error(`${file} doesn't exist`)
Expand Down

0 comments on commit e63e8fa

Please sign in to comment.