aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/worker/server.go4
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)
}