discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Incorrect requests for masked links with non-white-space character at the end

Open NeKzor opened this issue 2 years ago • 3 comments

Description

Discord currently fails to embed additional text/media data for masked links which include any non-white-space character right after the closing ). This is because it's looking for a white-space character to mark the end of a URL which results into sending an incorrect URL. I first observed this on one of my own websites but this also affects others, e.g. Twitter. Interestingly it does not affect YouTube links because they are smart enough to know how long their video IDs are.

Steps to Reproduce

Send the following message to a channel with example.com being a site you control:

[bug](https://example.com/_bug).
[bug](https://example.com/_bug)A
[bug](https://example.com/_bug)$
[bug](https://example.com/_bug) .
[bug](https://example.com/_bug) A
[bug](https://example.com/_bug) $

Expected Behavior

Observe a single request with the correct URL to: https://example.com/_bug

Current Behavior

Observe too many incorrect requests from the access logs:

"GET /_bug)$ HTTP/1.1" 200 955 "-" "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)" "-"
"GET /_bug). HTTP/1.1" 200 948 "-" "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)" "-"
"GET /_bug)A HTTP/1.1" 200 955 "-" "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)" "-"
"GET /_bug HTTP/1.1" 200 955 "-" "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)" "-"

Screenshots/Videos

No response

Client and System Information

NeKzor avatar Jul 08 '23 10:07 NeKzor

The client is rendering these correctly and navigate to the correct urls.

Are you suggesting this is a problem in regards to the requests made to the website to get embed information?

DV8FromTheWorld avatar Jul 10 '23 20:07 DV8FromTheWorld

Correct. I'm pointing out that there is a problem with the requests to get embed information. Clients are indeed rendering masked links correctly but the embed information is missing because of this bug.

NeKzor avatar Jul 11 '23 02:07 NeKzor

Yup, I understand now. I've logged the bug internally. Thanks for bringing this up.

DV8FromTheWorld avatar Jul 11 '23 15:07 DV8FromTheWorld