-
Notifications
You must be signed in to change notification settings - Fork 137
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
Warn user about possibly unexpected behaviour with certain filenames in embeds? #1081
Comments
This implicit name change is not specific to embeds, it's just that it's only there where it has clear side effects. I believe any The best idea I could come up with is to create a class level bool attribute on the This would allow users to globally enable validation of filenames, as well as per |
A relevant part from the official docs on uploading files |
Thanks for your thoughts. Since Discord docs say "must" (whilst currently disnake doesn't care about filenames at all), i think we should implement |
I think it is not neccesary to make it a definite error, since discord itself does not produce one, instead silently normalizing the filename. Hence, showing a warning should suffice, keeping everything else working as-is. |
That's particularly why i added that "including never" part. Since Discord says that's not right, we're not gonna make it look right too, but since Discord doesn't issue a hard error, we won't either. We can keep that attribute defaulting to |
I agree with everything but putting the control parameter in |
Where else then? Or should we tell the user to |
I imagine |
If we implement it this way then globally disabling/enabling validation will be up to the library (which controls the default value for that keyword argument), while it should really be up to the user. Requiring the user to put |
No no. As I've already described in my first comment, the keyword argument is for per instance basis warning. If you wish for it to always apply, you set the class var/use a classmethod for that. Perhaps, the constructor level argument could even raise actual exception. |
Alright, then good. |
my 2c on this issue: Overall it only concerns embeds (or more generally, A In addition, I'd say raising an exception in |
Summary
Warn user when they use try to attach files with non-ascii filenames to embeds.
What is the feature request for?
The core library
The Problem
It seems like Discord escapes spaces and non-ascii characters in attachment filenames, which leads to images in embeds that contain such characters appear outside of the embed when rendered in the client.
The Ideal Solution
User should be
warnings.warn
ed when they try to attach a file with "invalid" filename to an embed... warning::
s in related methods should be helpful too, since (unfortunately) not all users setup logging for their bot.The Current Solution
This is not an issue on our end, so N/A
Additional Context
Probably the best place to implement warning is
Embed._handle_resource()
.Credits to @Enegg for originally identifying the issue.
The text was updated successfully, but these errors were encountered: