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 11 months 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