Skip to content

Commit

Permalink
Fix for ephemeral attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
tiltowait committed Oct 2, 2023
1 parent 3ba6950 commit ceb2c7b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inconnu/character/images/upload.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Character image uploading."""

from urllib.parse import urlparse

import discord

import api
Expand Down Expand Up @@ -62,10 +64,10 @@ async def upload_image(ctx: discord.ApplicationContext, character, image: discor

def valid_url(url: str) -> bool:
"""Check whether a URL is a valid image URL."""
url = url.lower()
url = urlparse(url.lower())
Logger.debug("IMAGES: Checking validity of %s", url)

for extension in VALID_EXTENSIONS:
if url.endswith(extension):
if url.path.endswith(extension):
return True
return False

0 comments on commit ceb2c7b

Please sign in to comment.