mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 06:46:00 +00:00
magic.Magic(mime=True) loads the magic database from disk on construction; instantiating it per request was adding pointless overhead to every avatar and artwork upload. Share a module-level instance guarded by a lock (the underlying magic_t handle is not thread-safe), and surface MagicException as a 400 so a sniffing failure fails closed instead of bubbling a 500. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5.1 KiB
5.1 KiB