From caf0c3ee5cf658362d560883e6d5c6b8b14ead66 Mon Sep 17 00:00:00 2001 From: disqualifier Date: Fri, 16 Oct 2026 04:20:08 -0400 Subject: [PATCH] fix: cap cache_url at 100 MiB, the largest upload a bot can make bots can't have nitro, so discord's largest upload a bot can make is a boost tier 3 guild's 104857600 bytes (discord.py Guild.filesize_limit). 500 MiB admitted bodies no bot upload could carry. Signed-off-by: disqualifier --- src/dpy_cache/dpy_cache.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dpy_cache/dpy_cache.py b/src/dpy_cache/dpy_cache.py index 57b33f2..ab6573c 100644 --- a/src/dpy_cache/dpy_cache.py +++ b/src/dpy_cache/dpy_cache.py @@ -61,9 +61,10 @@ import discord log = logging.getLogger(__name__) MAX_ATTACHMENTS_PER_MESSAGE = 10 -# cache_url's body cap: discord's largest upload tier (500 MB, nitro), so nothing discord would -# accept is refused; it bounds memory, it is not the bot's real (per-guild) upload limit -MAX_CACHE_URL_BYTES = 500 * 1024 * 1024 +# cache_url's body cap: the largest upload a BOT can make (boost tier 3 guild, +# discord.py Guild.filesize_limit 104857600; bots can't have nitro), so nothing discord would +# accept from a bot is refused; it bounds memory, not the channel's own (tier) limit +MAX_CACHE_URL_BYTES = 100 * 1024 * 1024 FileContent = Union[bytes, bytearray, str, "os.PathLike[str]", discord.File]