From 2f49fcf74bb99c4d3870668e0713a4f70fa99e1b Mon Sep 17 00:00:00 2001 From: Hana Kim Date: Thu, 5 Mar 2026 22:49:14 -0500 Subject: all: run go fix -stringscutprefix Change-Id: I3c0a7e155ead790300ebe53e090ef9a42e655d3e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753432 kokoro-CI: kokoro LUCI-TryBot-Result: Go LUCI Reviewed-by: Jonathan Amsterdam --- internal/worker/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/worker/server.go b/internal/worker/server.go index 03c1d17b..eaac081c 100644 --- a/internal/worker/server.go +++ b/internal/worker/server.go @@ -404,8 +404,8 @@ func (s *Server) reportError(ctx context.Context, err error, w http.ResponseWrit // (this is symmetric with the proxy url scheme) func parseModulePathAndVersion(requestPath string) (string, string, error) { p := strings.TrimPrefix(requestPath, "/") - if strings.HasSuffix(p, "/@latest") { - modulePath := strings.TrimSuffix(p, "/@latest") + if before, ok := strings.CutSuffix(p, "/@latest"); ok { + modulePath := before if modulePath == "" { return "", "", fmt.Errorf("invalid module path: %q", modulePath) } -- cgit v1.3