From e23699fb956308c459873315d3bf6dbdc383f0ae Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Mon, 25 Jul 2022 13:01:19 +0200 Subject: [PATCH 1/2] See what happens in Windows env (through GitHub Action) --- lib/util.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/util.js b/lib/util.js index b75479ac..79897cd4 100644 --- a/lib/util.js +++ b/lib/util.js @@ -50,6 +50,8 @@ const parseGitUrl = remoteUrl => { if (!remoteUrl) return { host: null, owner: null, project: null, protocol: null, remote: null, repository: null }; const normalizedUrl = (remoteUrl || '').replace(/\\/g, '/'); const parsedUrl = gitUrlParse(normalizedUrl); + console.log({ remoteUrl, normalizedUrl }); + console.log(parsedUrl); const { resource: host, name: project, protocol, href: remote } = parsedUrl; const owner = protocol === 'file' ? _.last(parsedUrl.owner.split('/')) : parsedUrl.owner; const repository = `${owner}/${project}`; From 1336cfeeb8e0a7db198c88bff4993befad421786 Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Mon, 25 Jul 2022 16:39:40 +0200 Subject: [PATCH 2/2] Add workaround for Windows by removing drive letter from git url --- lib/util.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/util.js b/lib/util.js index 79897cd4..59110af0 100644 --- a/lib/util.js +++ b/lib/util.js @@ -48,12 +48,10 @@ const rejectAfter = (ms, error) => const parseGitUrl = remoteUrl => { if (!remoteUrl) return { host: null, owner: null, project: null, protocol: null, remote: null, repository: null }; - const normalizedUrl = (remoteUrl || '').replace(/\\/g, '/'); + const normalizedUrl = (remoteUrl || '').replace(/^[A-Z]:/, '').replace(/\\/g, '/'); // Hacky workaround for file protocol in Windows const parsedUrl = gitUrlParse(normalizedUrl); - console.log({ remoteUrl, normalizedUrl }); - console.log(parsedUrl); const { resource: host, name: project, protocol, href: remote } = parsedUrl; - const owner = protocol === 'file' ? _.last(parsedUrl.owner.split('/')) : parsedUrl.owner; + const owner = protocol === 'file' ? _.last(parsedUrl.owner.split('/')) : parsedUrl.owner; // Fix owner for file protocol const repository = `${owner}/${project}`; return { host, owner, project, protocol, remote, repository }; };