Skip to content

Commit

Permalink
Merge pull request python-discord#824 from python-discord/antimalware…
Browse files Browse the repository at this point in the history
…-fix

Fix filtered extension string out of scope for antismalware log message
  • Loading branch information
MarkKoz authored Mar 9, 2020
2 parents 2c305c1 + 6e8e97c commit 3fe0f5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bot/cogs/antimalware.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ async def on_message(self, message: Message) -> None:
return

embed = Embed()
file_extensions = {splitext(message.filename.lower())[1] for message in message.attachments}
file_extensions = {splitext(attachment.filename.lower())[1] for attachment in message.attachments}
extensions_blocked = file_extensions - set(AntiMalwareConfig.whitelist)
blocked_extensions_str = ', '.join(extensions_blocked)
if ".py" in extensions_blocked:
# Short-circuit on *.py files to provide a pastebin link
embed.description = (
"It looks like you tried to attach a Python file - "
f"please use a code-pasting service such as {URLs.site_schema}{URLs.site_paste}"
)
elif extensions_blocked:
blocked_extensions_str = ', '.join(extensions_blocked)
whitelisted_types = ', '.join(AntiMalwareConfig.whitelist)
meta_channel = self.bot.get_channel(Channels.meta)
embed.description = (
Expand Down

0 comments on commit 3fe0f5c

Please sign in to comment.