From ce3a7266b9fe5c6560f31fbf9e3c867de992c652 Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Mon, 25 Jul 2022 17:05:10 +0200 Subject: [PATCH] Add workaround for Windows by removing drive letter from git url (#924) * See what happens in Windows env (through GitHub Action) * Add workaround for Windows by removing drive letter from git url --- lib/util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util.js b/lib/util.js index b75479ac..59110af0 100644 --- a/lib/util.js +++ b/lib/util.js @@ -48,10 +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); 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 }; };