From 5c14149873368060c0b86c95914753ab7b283097 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Fri, 1 Apr 2022 15:25:03 -0400 Subject: [PATCH] Fix filename spoiler stripping method lstrip does not work as expected --- discord/file.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/discord/file.py b/discord/file.py index 0366cee58..d1182417f 100644 --- a/discord/file.py +++ b/discord/file.py @@ -38,7 +38,9 @@ __all__ = ( def _strip_spoiler(filename: str) -> Tuple[str, bool]: - stripped = filename.lstrip('SPOILER_') + stripped = filename + while stripped.startswith('SPOILER_'): + stripped = stripped[8:] # len('SPOILER_') spoiler = stripped != filename return stripped, spoiler