internal/queue: check for unknown module path
ScheduleFetch checks that it is not given "unknownModulePath".
Change-Id: Ie2ae0bde75ad10103b9ea8fb526aa7f09c285733
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/304889
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/internal/queue/queue.go b/internal/queue/queue.go
index c77f3b5..30d9274 100644
--- a/internal/queue/queue.go
+++ b/internal/queue/queue.go
@@ -18,6 +18,7 @@
cloudtasks "cloud.google.com/go/cloudtasks/apiv2"
"github.com/golang/protobuf/ptypes"
+ "golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/config"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
@@ -124,6 +125,9 @@
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
+ if modulePath == internal.UnknownModulePath {
+ return false, errors.New("given unknown module path")
+ }
req := q.newTaskRequest(modulePath, version, suffix, disableProxyFetch)
enqueued = true
if _, err := q.client.CreateTask(ctx, req); err != nil {