From 233fac44be2d5665490e1d82cbb472ae99845a2e Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Thu, 25 Mar 2021 15:53:53 -0400 Subject: 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 Run-TryBot: Jonathan Amsterdam Reviewed-by: Julie Qiu --- internal/queue/queue.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/queue/queue.go') diff --git a/internal/queue/queue.go b/internal/queue/queue.go index c77f3b52..30d92742 100644 --- a/internal/queue/queue.go +++ b/internal/queue/queue.go @@ -18,6 +18,7 @@ import ( 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 @@ func (q *GCP) ScheduleFetch(ctx context.Context, modulePath, version, suffix str 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 { -- cgit v1.3