Closed Penwy closed 7 months ago
As we don't know whether Discord will stick with the new system, maybe we should check for both?
Just use urlparse to get the actual path minus query parameters in a safe way and then check that it ends in .txt
Thanks rod, hadn't thought of urlparse :purple_heart:
Description
This changes the way the bot detects attachments to be txt files (for the purpose of analysing them), in order to work with discord's recent changes to attachment URLs.
Motivation and Context
Discord recently changed URLs of attachments by adding a query string to it. As a result of this the bot isn't recognising text files as such anymore (because it only looks at the end of the url), which is a slight hindrance to support, as the analysis is a great help.
How Has This Been Tested?
I currently do not have the ability to test this in an actual environment, running the bot. The only testing I could do was verifying the condition did evaluate to true for actual URLs of discord text file attachments. However, given how minimal and trivial the change is, I do think that is enough testing.
Types of changes
Checklist: