Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Audio] Fix attachment suffix reading on playlist upload w/ urllib #6280

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions redbot/cogs/audio/core/commands/playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from io import BytesIO
from pathlib import Path
from urllib.parse import urlparse
from typing import cast

import discord
Expand Down Expand Up @@ -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.")
Expand All @@ -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 (
Expand Down
Loading