Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 528913 - TypeError: Parameter "url" must be a string, not undefined
  • Loading branch information
grant-g committed Dec 18, 2017
1 parent 5229175 commit 2c8929b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions modules/orionode/lib/git/clone.js
Expand Up @@ -702,25 +702,25 @@ function getRemoteCallbacks(creds, username, task) {
}

function handleRemoteError(task, err, cloneUrl) {
var fullCloneUrl;
if (cloneUrl.indexOf("://") !== -1){
fullCloneUrl = cloneUrl;
} else if (cloneUrl.indexOf("@") !== -1 && cloneUrl.indexOf("@") < cloneUrl.indexOf(":")){
fullCloneUrl = "ssh://" + cloneUrl;
}
var u = url.parse(fullCloneUrl, true);
var code = err.code || 500;
var jsonData, message = err.message;
if (err.message && ["credentials", "authentication", "401"].some(function(s) { return err.message.indexOf(s) !== -1; })) {
code = 401;
jsonData = {
"Host": u.hostname,
"HumanishName": u.pathname.substring(u.pathname.lastIndexOf("/") + 1).replace(".git", ""),
"Port": u.port,
"Scheme": u.protocol && u.protocol.replace(":", ""),
"Url": cloneUrl,
"User": u.auth
};
jsonData = {"Url": cloneUrl};
var fullCloneUrl;
if (cloneUrl.indexOf("://") !== -1) {
fullCloneUrl = cloneUrl;
} else if (cloneUrl.indexOf("@") !== -1 && cloneUrl.indexOf("@") < cloneUrl.indexOf(":")) {
fullCloneUrl = "ssh://" + cloneUrl;
}
if (fullCloneUrl) {
var u = url.parse(fullCloneUrl, true);
jsonData.Host = u.hostname;
jsonData.HumanishName = u.pathname.substring(u.pathname.lastIndexOf("/") + 1).replace(".git", "");
jsonData.Port = u.port;
jsonData.Scheme = u.protocol && u.protocol.replace(":", "");
jsonData.User = u.auth;
}
} else if (err.message && ["404"].some(function(s) { return err.message.indexOf(s) !== -1; })) {
code = 404;
message = "Remote repository does not exist";
Expand Down

0 comments on commit 2c8929b

Please sign in to comment.