fix: don't parse port as part of the path in repository URLs (#1671)

This commit is contained in:
Arthur Chaloin
2020-10-28 15:53:03 -07:00
committed by GitHub
parent d74ffef788
commit 77a75f072b
2 changed files with 29 additions and 3 deletions
+3 -3
View File
@@ -53,10 +53,10 @@ module.exports = async ({cwd, env, branch, options: {repositoryUrl}}) => {
if (gitCredentials) {
// If credentials are set via environment variables, convert the URL to http/https and add basic auth, otherwise return `repositoryUrl` as is
const [match, auth, host, path] =
/^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<path>.*)$/.exec(repositoryUrl) || [];
const [match, auth, host, basePort, path] =
/^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<port>\d+)?:?\/?(?<path>.*)$/.exec(repositoryUrl) || [];
const {port, hostname, ...parsed} = parse(
match ? `ssh://${auth ? `${auth}@` : ''}${host}/${path}` : repositoryUrl
match ? `ssh://${auth ? `${auth}@` : ''}${host}${basePort ? `:${basePort}` : ''}/${path}` : repositoryUrl
);
return format({