From 6c98d03ae7a37024062157c2dfeab400cbce437c Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Sun, 13 Jul 2025 05:42:07 -0500 Subject: [PATCH] fix: trim query parameters from URL path in ServeHTTP to ensure cache key correctness --- steamcache/steamcache.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/steamcache/steamcache.go b/steamcache/steamcache.go index 1845d5d..5fd9b5f 100644 --- a/steamcache/steamcache.go +++ b/steamcache/steamcache.go @@ -218,6 +218,10 @@ func (sc *SteamCache) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if strings.HasPrefix(r.URL.String(), "/depot/") { + // trim the query parameters from the URL path + // this is necessary because the cache key should not include query parameters + r.URL.Path = strings.Split(r.URL.Path, "?")[0] + tstart := time.Now() defer func() { responseTime.Observe(time.Since(tstart).Seconds()) }()