Skip to content

Commit e63e8fa

Browse files
committed
fix: trim the whole string, otherwise detection of windows-like path is not robust
Close #1596
1 parent 381e8c0 commit e63e8fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/electron-builder/src/codeSign.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export interface CodeSigningInfo {
1919
}
2020

2121
export async function downloadCertificate(urlOrBase64: string, tmpDir: TmpDir, currentDir: string): Promise<string> {
22+
urlOrBase64 = urlOrBase64.trim()
23+
2224
let file: string | null = null
2325
if ((urlOrBase64.length > 3 && urlOrBase64[1] === ":") || urlOrBase64.startsWith("/") || urlOrBase64.startsWith(".")) {
2426
file = urlOrBase64
@@ -46,7 +48,7 @@ export async function downloadCertificate(urlOrBase64: string, tmpDir: TmpDir, c
4648
}
4749
}
4850

49-
file = path.resolve(currentDir, file.trim())
51+
file = path.resolve(currentDir, file)
5052
const stat = await statOrNull(file)
5153
if (stat == null) {
5254
throw new Error(`${file} doesn't exist`)

0 commit comments

Comments
 (0)