Browse Source

Much stricter repo URL checking

master
Leo Lamprecht 8 years ago
parent
commit
4a5de7321a
No known key found for this signature in database GPG Key ID: B08517883D5E0E10
  1. 2
      bin/now-deploy.js
  2. 4
      lib/github.js

2
bin/now-deploy.js

@ -229,7 +229,7 @@ async function sync(token) {
// once the deployment has finished
Object.assign(gitHubRepo, repo)
} else if (isValidRepo === 'no-valid-url') {
stopDeployment(`URL is no valid repository from GitHub or GitLab.`)
stopDeployment(`This URL is not a valid repository from GitHub or GitLab.`)
} else if (isValidRepo) {
const gitRef = gitHubRepo.ref ? `with "${chalk.bold(gitHubRepo.ref)}" ` : ''
stopDeployment(`There's no repository named "${chalk.bold(gitHubRepo.main)}" ${gitRef}on GitHub or GitLab`)

4
lib/github.js

@ -90,8 +90,8 @@ export const isRepoPath = path => {
if (isURL(path)) {
const urlParts = url.parse(path)
const slashCount = (urlParts.path.match(new RegExp('/', 'g')) || []).length
const notBare = slashCount >= 2
const slashSplitted = urlParts.path.split('/').filter(n => n)
const notBare = slashSplitted.length >= 2
if (allowedHosts.includes(urlParts.host) && notBare) {
return true

Loading…
Cancel
Save