Leo Lamprecht
8 years ago
No known key found for this signature in database
GPG Key ID: B08517883D5E0E10
1 changed files with
6 additions and
2 deletions
-
lib/github.js
|
|
@ -10,7 +10,6 @@ import isURL from 'is-url' |
|
|
|
|
|
|
|
const downloadRepo = async repoPath => { |
|
|
|
const pathParts = gitPathParts(repoPath) |
|
|
|
console.log(pathParts) |
|
|
|
const url = `https://api.github.com/repos/${pathParts.main}/tarball/${pathParts.ref}` |
|
|
|
|
|
|
|
const tmpDir = await tmp.dir({ |
|
|
@ -73,12 +72,17 @@ export const isRepoPath = path => { |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
const allowedHosts = [ |
|
|
|
'github.com', |
|
|
|
'gitlab.com' |
|
|
|
] |
|
|
|
|
|
|
|
if (isURL(path)) { |
|
|
|
const urlParts = url.parse(path) |
|
|
|
const slashCount = (urlParts.path.match(new RegExp('/', 'g')) || []).length |
|
|
|
const notBare = slashCount >= 2 |
|
|
|
|
|
|
|
if (urlParts.host === 'github.com' && notBare) { |
|
|
|
if (allowedHosts.includes(urlParts.host) && notBare) { |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|