mirror of
https://github.com/matrix-org/dendrite
synced 2024-12-13 21:53:32 +01:00
Un-ratelimit calls to /thumbnail (#2251)
This commit is contained in:
parent
7fc62d8178
commit
5e694cd362
1 changed files with 8 additions and 5 deletions
|
@ -120,13 +120,16 @@ func makeDownloadAPI(
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
// Ratelimit requests
|
// Ratelimit requests
|
||||||
if r := rateLimits.Limit(req); r != nil {
|
// NOTSPEC: The spec says everything at /media/ should be rate limited, but this causes issues with thumbnails (#2243)
|
||||||
if err := json.NewEncoder(w).Encode(r); err != nil {
|
if name != "thumbnail" {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
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
|
return
|
||||||
}
|
}
|
||||||
w.WriteHeader(http.StatusTooManyRequests)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vars, _ := httputil.URLDecodeMapValues(mux.Vars(req))
|
vars, _ := httputil.URLDecodeMapValues(mux.Vars(req))
|
||||||
|
|
Loading…
Reference in a new issue