From cd09798549f16020412b38ed20faf6817d8af5eb Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Fri, 4 Mar 2022 11:38:40 +0100 Subject: [PATCH] Un-ratelimit calls to /thumbnail --- mediaapi/routing/routing.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mediaapi/routing/routing.go b/mediaapi/routing/routing.go index fc2136bb6..0e1583991 100644 --- a/mediaapi/routing/routing.go +++ b/mediaapi/routing/routing.go @@ -120,13 +120,16 @@ func makeDownloadAPI( w.Header().Set("Content-Type", "application/json") // Ratelimit requests - if r := rateLimits.Limit(req); r != nil { - if err := json.NewEncoder(w).Encode(r); err != nil { - w.WriteHeader(http.StatusInternalServerError) + // NOTSPEC: The spec says everything at /media/ should be rate limited, but this causes issues with thumbnails (#2243) + if name != "thumbnail" { + if r := rateLimits.Limit(req); r != nil { + if err := json.NewEncoder(w).Encode(r); err != nil { + w.WriteHeader(http.StatusInternalServerError) + return + } + w.WriteHeader(http.StatusTooManyRequests) return } - w.WriteHeader(http.StatusTooManyRequests) - return } vars, _ := httputil.URLDecodeMapValues(mux.Vars(req))