Files
appwrite/app/controllers/shared
loks0nandClaude Opus 4.7 eb936865dd fix(storage): allow cache bypass and refuse to cache non-image responses
Previously, any 2xx response with a non-empty payload on a route with
`label('cache', true)` was persisted to the filesystem cache for 180
days, and clients had no per-URL way to invalidate it. If an incident
produced a non-image body on one of these routes (e.g. a truncated
read, a fallback body, or a partial Imagick output) the bad content
was served from cache indefinitely.

- Load hook: honor `Cache-Control: no-cache` / `no-store` on the
  request. Skip the cache load, let the action re-run, and let the
  existing save path overwrite the poisoned entry. Emits
  `X-Appwrite-Cache: bypass` and a telemetry counter.
- Save hook: refuse to cache unless the response `Content-Type` is
  `image/*`. Every route currently opting into caching sets an image
  content type via `Response::file()`; anything else is an error or
  fallback and must not become the authoritative cached answer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 11:24:22 +01:00
..