From b1ab0b2d52be222fd746b16bc3525b1b872e54d2 Mon Sep 17 00:00:00 2001 From: Herman Schaaf Date: Fri, 5 Aug 2016 00:16:46 +0800 Subject: [PATCH] Fix edge case with invalid repo names --- download/download.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/download/download.go b/download/download.go index eb73f35..8231146 100644 --- a/download/download.go +++ b/download/download.go @@ -77,7 +77,10 @@ func download(path, dest string, firstAttempt bool) (root *vcs.RepoRoot, err err func Clean(path string) (string, error) { importPath := trimUsername(trimScheme(path)) root, err := vcs.RepoRootForImportPath(importPath, true) - if root.Root == "" || root.Repo == "" { + if err != nil { + return "", err + } + if root != nil && (root.Root == "" || root.Repo == "") { return root.Root, errors.New("Empty repo root") } return root.Root, err