fix github regexp: allow more than 1 directory deep in the repo Fixes #340
diff --git a/gosrc/github.go b/gosrc/github.go index 181d938..0de8968 100644 --- a/gosrc/github.go +++ b/gosrc/github.go
@@ -18,7 +18,7 @@ func init() { addService(&service{ - pattern: regexp.MustCompile(`^github\.com/(?P<owner>[a-z0-9A-Z_.\-]+)/(?P<repo>[a-z0-9A-Z_.\-]+)(?P<dir>/[^/]*)?$`), + pattern: regexp.MustCompile(`^github\.com/(?P<owner>[a-z0-9A-Z_.\-]+)/(?P<repo>[a-z0-9A-Z_.\-]+)(?P<dir>/.*)?$`), prefix: "github.com/", get: getGitHubDir, getPresentation: getGitHubPresentation,
diff --git a/gosrc/path_test.go b/gosrc/path_test.go index be9fc0f..5b4ec96 100644 --- a/gosrc/path_test.go +++ b/gosrc/path_test.go
@@ -36,7 +36,15 @@ if !IsValidRemotePath(importPath) { t.Errorf("isBadImportPath(%q) -> true, want false", importPath) } + + for _, s := range services { + if _, err := s.match(importPath); err != nil { + t.Errorf("match(%#v) → error %v", importPath, err) + break + } + } } + for _, importPath := range badImportPaths { if IsValidRemotePath(importPath) { t.Errorf("isBadImportPath(%q) -> false, want true", importPath)