From 094855afb5c6b2f99082c9ee7bae37624a2846b5 Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Mon, 3 Jul 2017 23:03:51 +0200 Subject: [PATCH] Fix undefined repository owner error (#15) --- src/projects/helpers/sync.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/projects/helpers/sync.js b/src/projects/helpers/sync.js index 5ff67ca..f2dc2be 100644 --- a/src/projects/helpers/sync.js +++ b/src/projects/helpers/sync.js @@ -1,5 +1,6 @@ import { exec } from 'child-process-promise'; import { VError } from 'verror'; +import _ from 'lodash'; import config from '../../config'; import { ProjectWorkspace } from '../models'; @@ -34,10 +35,11 @@ export default { authParam = ''; } + const repoOwner = _.defaultTo(projectWorkspace.project.owner, config.defaultRepoOwner); const cmd = ` mkdir -p ${projectWorkspace.getContractsPath()} \\ - && curl --fail --silent ${authParam} -L 'https://api.github.com/repos/${projectWorkspace - .project.owner}/${projectWorkspace.project.repo}/tarball/${projectWorkspace.rev}' \\ + && curl --fail --silent ${authParam} -L 'https://api.github.com/repos/${repoOwner}/${projectWorkspace + .project.repo}/tarball/${projectWorkspace.rev}' \\ | tar xz -C ${projectWorkspace.getPath()} --strip-components 1 --wildcards '*/${projectWorkspace .project.dir}/' --anchored `;