-
Notifications
You must be signed in to change notification settings - Fork 579
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
Attachment names string treatment is not consistent between different functions #2635
Comments
I'll try looking into this |
This is caused by a URL sanitation issue. The This is a temporary fix: pub fn attachment(self, filename: impl Into<String>) -> Self {
let mut filename = filename.into();
filename.retain(|c| c != '\'');
filename.insert_str(0, "attachment://");
self.image(filename)
} Will try and check if there are better ways to ensure UPDATE: Found that when there are invalid characters, the |
Thanks for looking into this. I know of the work around (just not add invalid characters .. duh!). Yes what you're describing is the same behavior I found. |
Discord converts the names when they include characters it doesn't like, which means that when supplying the attachment name to the embed, it doesn't point to the real attachment anymore. This is more of a quirk than a bug, and would require filtering the name by the lib, which is currently out of scope incase discord changes in the future. |
Maybe we should add a warning in the docs about it? And if there's nothing more to do about this, then perhaps this issue can be closed? |
A “fix” would have serenity do Discord’s treatment internally to all strings passed through it. |
Is that not what was discussed here:
|
Serenity version: I am using
poise 0.6.0
Rust version (
rustc -V
): 1.74Minimal test case if possible:
the apostrophe in
attachment_name
causes the two functions to give different output somehow. The attachment is no longer in the embed.Removing the apostrophe resolved that problem.
The text was updated successfully, but these errors were encountered: