From e63e8fa9bf2d5031f0f667eef1227aef48ac4159 Mon Sep 17 00:00:00 2001 From: develar Date: Tue, 30 May 2017 12:28:35 +0200 Subject: [PATCH] fix: trim the whole string, otherwise detection of windows-like path is not robust Close #1596 --- packages/electron-builder/src/codeSign.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/electron-builder/src/codeSign.ts b/packages/electron-builder/src/codeSign.ts index 874c237e184..c93d628252a 100644 --- a/packages/electron-builder/src/codeSign.ts +++ b/packages/electron-builder/src/codeSign.ts @@ -19,6 +19,8 @@ export interface CodeSigningInfo { } export async function downloadCertificate(urlOrBase64: string, tmpDir: TmpDir, currentDir: string): Promise { + urlOrBase64 = urlOrBase64.trim() + let file: string | null = null if ((urlOrBase64.length > 3 && urlOrBase64[1] === ":") || urlOrBase64.startsWith("/") || urlOrBase64.startsWith(".")) { file = urlOrBase64 @@ -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`)