Skip to content

Commit d7d85fc

Browse files
committed
src/gpg.ts: Fix regression with C:\dir style keyring paths
gpg on windows doesn't seem to accept C:\dir paths, it only copes with /c/dir. Signed-off-by: Andrei Horodniceanu <[email protected]>
1 parent 51b2bff commit d7d85fc

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gpg.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@ export async function verify(file_path: string, sig_url: string) {
66
let keyring = await tc.downloadTool("https://dlang.org/d-keyring.gpg");
77
let sig_path = await tc.downloadTool(sig_url);
88
// hack to workaround gpg on windows interaction with paths
9-
keyring = core.toPosixPath(keyring);
10-
sig_path = core.toPosixPath(sig_path);
9+
keyring = win_path_to_msys(keyring);
10+
1111
await exec.exec(
12-
'gpg',
12+
'gpg',
1313
[ '--lock-never', '--verify', '--keyring', keyring, '--no-default-keyring',
1414
sig_path, file_path ]
1515
)
1616
}
17+
18+
// hack to workaround gpg on windows interaction with paths
19+
function win_path_to_msys(path: string) {
20+
if (process.platform != "win32")
21+
return path
22+
23+
path = core.toPosixPath(path)
24+
const drive = path[0]
25+
path = '/' + drive + path.slice(2)
26+
return path
27+
}

0 commit comments

Comments
 (0)