Skip to content

Commit

Permalink
Add workaround for Windows by removing drive letter from git url (#924)
Browse files Browse the repository at this point in the history
* See what happens in Windows env (through GitHub Action)

* Add workaround for Windows by removing drive letter from git url
  • Loading branch information
webpro committed Jul 25, 2022
1 parent b830876 commit ce3a726
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/util.js
Expand Up @@ -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 };
};
Expand Down

0 comments on commit ce3a726

Please sign in to comment.