-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(Util): escapeInlineCode properly #7587
Conversation
fixes: #7373 The purpose of this method is to remove all the markdowns but as shown in the issue that it's not able to remove `inlineCode` for some strings where additional backtics are used. The current change works fine for any input.
I don't this patch is correct. This simply escapes all backticks. As a result, it does escape inline code, but also escapes code blocks, even though that's a separate function and not the intended functionality of this function by itself. A fix should be implemented, and tests should be added, to ensure that this function does not escape backticks which form a code block in discord. I've tried a few different strings, and I'm not sure exactly what the correct rules are. For example: This one:
Results in inline code containing "``a". This one:
Results in plaintext "`a" followed by a code block containing "b" And this one:
Results in plaintext "`a```b```" There are probably more weird corner cases like this. Not really sure what the best solution is, other than to randomly generate a bunch of these, and then progressively add more of them as test cases until there are no discrepancies between what Discord and Discord.js identify as inline code or a code block. |
I'll probably create a new pr to ignore code blocks. |
Why would it be a new PR if it's been identified as a defect of this PR? EDIT: I see now this is already merged |
Please describe the changes this PR makes and why it should be merged:
fixes: #7373
The purpose of this method is to remove all the markdowns but as shown in the issue that it's not able to remove
inlineCode
for some strings where additional backticks are used. The current change works fine for any input.Status and versioning classification: