Skip to content

Commit 34c4748

Browse files
committed
Format of data received has changed
Renaming res to result, since it may be confused with response. Instead of res.request.uri.path the path is now found in result.req.path as on util.inspect ing the result object we find [ { req: { domain: null, ... method: 'GET', path: '/teams/233393/members/saraf?access_token=fa5657bf47838731ef4ce82a929faba19803a097', //<=== this is what we want ... res: [Object] }, res: { _readableState: [Object], readable: false, domain: null, ... Note: I do not know if we can reliably test for the account being an enterprise git account by looking at the path for "/api/v3" (and the req object does not now have a "uri" property anymore.) Needs to be tested/looked at by someone with an enterprise git account.
1 parent d4c6999 commit 34c4748

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/api.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,18 +415,21 @@ function getRepos(token, username, callback) {
415415
}
416416
var team_detail_requests = this.team_detail_requests;
417417
var group = this.group();
418-
_.each(results, function (res) {
419-
var team_id = res.request.uri.path.split('/');
420-
if (res.request.uri.path.indexOf('/api/v3/') > -1) {
418+
419+
_.each(results, function (result) {
420+
var team_id = result.req.path.split('/');
421+
if (result.req.path.indexOf('/api/v3/') > -1) {
421422
// Github Enterprise url
422-
team_id = team_id[4];
423+
team_id = team_id[4]; //TODO: need a github enterprise account for
424+
// this to be tested - does the path
425+
// really contain /api/v3?
423426
}
424427
else {
425428
// Github url
426429
team_id = team_id[2];
427430
}
428431
var team_detail = team_detail_requests[parseInt(team_id, 10)];
429-
if (res.statusCode === 204) {
432+
if (result.statusCode === 204) {
430433
pageinated_api_call('/teams/' + team_id + '/repos', token, group());
431434
}
432435

@@ -438,6 +441,7 @@ function getRepos(token, username, callback) {
438441
debug('get_github_repos(): Error with team repos request: %s', err);
439442
return callback(err);
440443
}
444+
441445
_.each(results, function (result) {
442446
if (result && result.data) {
443447
_.each(result.data, function (team_repo) {
@@ -459,6 +463,7 @@ function getRepos(token, username, callback) {
459463
});
460464
}
461465
});
466+
462467
// Sometimes we can get multiple copies of the same team repo, so we uniq it
463468
team_repos = _.uniq(team_repos, false, function (item) {
464469
return item.id;

0 commit comments

Comments
 (0)