Browse Source

Fix filename spoiler stripping method

lstrip does not work as expected
pull/7824/head
Rapptz 3 years ago
parent
commit
5c14149873
  1. 4
      discord/file.py

4
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

Loading…
Cancel
Save