Skip to content

Commit 24656d5

Browse files
Merge pull request #210 from Holinc19/bugfix-207
fix: issue#207, Response code 401 (Unauthorized)
2 parents cecc6e7 + a29e85e commit 24656d5

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ function browse(options) {
266266
var page = options.page || ''
267267
if (page === '') {
268268
open(
269-
gitlab.options.url + '/' + projectName + '/tree/' + curBranchName
269+
gitlab.options.host + '/' + projectName + '/tree/' + curBranchName
270270
)
271271
} else {
272-
open(gitlab.options.url + '/' + projectName + '/' + page)
272+
open(gitlab.options.host + '/' + projectName + '/' + page)
273273
}
274274
})
275275
})
@@ -306,7 +306,7 @@ function compare(options) {
306306
var targetBranch = options.target || defaultBranch
307307
var sourceBranch = baseBranch
308308
open(
309-
gitlab.options.url +
309+
gitlab.options.host +
310310
'/' +
311311
projectName +
312312
'/compare/' +
@@ -405,7 +405,7 @@ function openMergeRequests(options) {
405405
}
406406

407407
open(
408-
gitlab.options.url +
408+
gitlab.options.host +
409409
'/' +
410410
projectName +
411411
'/merge_requests' +
@@ -436,7 +436,7 @@ function createMergeRequest(options) {
436436
return getURLOfRemote(remote)
437437
})
438438
.then(function(remoteURL) {
439-
var gitlabHost = URL.parse(gitlab.options.url).host
439+
var gitlabHost = URL.parse(gitlab.options.host).host
440440

441441
logger.log('\ngitlab host obtained : ' + gitlabHost.green)
442442

@@ -590,7 +590,7 @@ function createMergeRequest(options) {
590590

591591
if (!url) {
592592
url =
593-
gitlab.options.url +
593+
gitlab.options.host +
594594
'/' +
595595
targetProjectName +
596596
'/merge_requests/' +

options.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ var git = {
1515
},
1616
}
1717
};
18-
18+
1919
var options = (function () {
2020
var options = {
21-
url: git.config.get('gitlab.url') || process.env.GITLAB_URL,
21+
host: git.config.get('gitlab.url') || process.env.GITLAB_URL,
2222
token: git.config.get('gitlab.token') || process.env.GITLAB_TOKEN,
2323
};
24-
25-
if (!options.url) {
24+
25+
if (!options.host) {
2626
var defaultInput = (function () {
2727
var url = git.config.get('remote.origin.url');
2828
if (!url || url.indexOf('bitbucket') !== -1 || url.indexOf('github') !== -1) {
@@ -31,15 +31,15 @@ var git = {
3131
return 'https://' + gitUrlParse(url).resource;
3232
})();
3333
var urlQuestion = ('Enter GitLab URL (' + defaultInput + '): ').yellow;
34-
while (!options.url) {
35-
options.url = readlineSync.question(urlQuestion, { defaultInput: defaultInput });
34+
while (!options.host) {
35+
options.host = readlineSync.question(urlQuestion, { defaultInput: defaultInput });
3636
urlQuestion = 'Invalid URL (try again): '.red;
3737
}
38-
git.config.set('gitlab.url', options.url);
38+
git.config.set('gitlab.url', options.host);
3939
}
40-
40+
4141
if (!options.token) {
42-
var url = options.url + '/profile/personal_access_tokens';
42+
var url = options.host + '/profile/personal_access_tokens';
4343
console.log('A personal access token is needed to use the GitLab API\n' + url.grey);
4444
var tokenQuestion = 'Enter personal access token: '.yellow;
4545
while (!options.token) {
@@ -50,8 +50,8 @@ var git = {
5050
}
5151

5252
options.rejectUnauthorized = false;
53-
53+
5454
return options;
5555
})();
5656

57-
module.exports = options
57+
module.exports = options

0 commit comments

Comments
 (0)