You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function will return ``a\`, indicating only the last backtick was escaped by prepending a backslash. The bot's message will appear as shown below:
As you can see, it's rendered as inline code with the content `a\, indicating the first and last backtick were interpreted as marking inline code, even though the last backtick is supposed to be escaped.
In order to correctly escape this string, Util.escapeInlineCode should've returned \`\`a` or \`\`a\`.
Note that the a can be replaced with any string without backticks, as far as I can tell, without affecting the issue. Perhaps there are other kinds of strings you could craft that would cause similar failures, but I couldn't find any.
I'm not sure the exact best way to fix this method, as it may be dependent on exactly how Discord's own markdown parser is built.
Code sample
Util.escapeInlineCode("``a`")
Package version
discord.js@13.5.1
Node.js version
v16.13.1
Operating system
Windows
Priority this issue should have
Low (slightly annoying)
Which partials do you have configured?
Not applicable (subpackage bug)
Which gateway intents are you subscribing to?
Not applicable (subpackage bug)
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered:
Which package is this bug report for?
discord.js
Issue description
Have the bot send a message with the content:
The function will return
``a\`
, indicating only the last backtick was escaped by prepending a backslash. The bot's message will appear as shown below:As you can see, it's rendered as inline code with the content
`a\
, indicating the first and last backtick were interpreted as marking inline code, even though the last backtick is supposed to be escaped.In order to correctly escape this string,
Util.escapeInlineCode
should've returned\`\`a`
or\`\`a\`
.Note that the
a
can be replaced with any string without backticks, as far as I can tell, without affecting the issue. Perhaps there are other kinds of strings you could craft that would cause similar failures, but I couldn't find any.I'm not sure the exact best way to fix this method, as it may be dependent on exactly how Discord's own markdown parser is built.
Code sample
Package version
discord.js@13.5.1
Node.js version
v16.13.1
Operating system
Windows
Priority this issue should have
Low (slightly annoying)
Which partials do you have configured?
Not applicable (subpackage bug)
Which gateway intents are you subscribing to?
Not applicable (subpackage bug)
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: