diff options
| author | Hana Kim <hyangah@gmail.com> | 2026-03-05 22:49:14 -0500 |
|---|---|---|
| committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | 2026-03-27 08:05:57 -0700 |
| commit | 2f49fcf74bb99c4d3870668e0713a4f70fa99e1b (patch) | |
| tree | bb9cf75749b3dce27ef9b4e74249ebec37dbd3a3 /internal/worker | |
| parent | fbe6ac1b69af2e486e8b714a58c635e770d7b623 (diff) | |
| download | go-x-pkgsite-2f49fcf74bb99c4d3870668e0713a4f70fa99e1b.tar.xz | |
all: run go fix -stringscutprefix
Change-Id: I3c0a7e155ead790300ebe53e090ef9a42e655d3e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753432
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/worker')
| -rw-r--r-- | internal/worker/server.go | 4 |
1 files 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) } |
