diff --git a/redbot/cogs/audio/core/commands/playlists.py b/redbot/cogs/audio/core/commands/playlists.py index 746b4588193..b654828f8e3 100644 --- a/redbot/cogs/audio/core/commands/playlists.py +++ b/redbot/cogs/audio/core/commands/playlists.py @@ -7,6 +7,7 @@ from io import BytesIO from pathlib import Path +from urllib.parse import urlparse from typing import cast import discord @@ -1823,7 +1824,7 @@ async def command_playlist_upload( file_url = file_message.attachments[0].url except IndexError: return await self.send_embed_msg(ctx, title=_("Upload cancelled.")) - file_suffix = file_url.rsplit(".", 1)[1] + file_suffix = urlparse(file_url).path.rsplit(".", 1)[1] if file_suffix != "txt": return await self.send_embed_msg( ctx, title=_("Only Red playlist files can be uploaded.") @@ -1848,7 +1849,7 @@ async def command_playlist_upload( if len(track_list) > 10000: return await self.send_embed_msg(ctx, title=_("This playlist is too large.")) uploaded_playlist_name = uploaded_playlist.get( - "name", (file_url.split("/")[6]).split(".")[0] + "name", (urlparse(file_url).path.split("/")[-1]).rsplit(".", 1)[0] ) try: if self.api_interface is not None and (