Skip to content
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(escapeMarkdown): fix double escaping #8798

Merged
merged 4 commits into from Nov 19, 2022

Conversation

RedGuy12
Copy link
Contributor

@RedGuy12 RedGuy12 commented Oct 30, 2022

Please describe the changes this PR makes and why it should be merged:

Fixes escapeMarkdown double-escaping everything. This happened because escapeEscapes was called after most things were already escaped.

  if (inlineCode) text = escapeInlineCode(text);
  if (codeBlock) text = escapeCodeBlock(text);
  if (italic) text = escapeItalic(text);
  if (bold) text = escapeBold(text);
// text === "foo_bar"
  if (underline) text = escapeUnderline(text);
// text === "foo\\_bar"
  if (strikethrough) text = escapeStrikethrough(text);
  if (spoiler) text = escapeSpoiler(text);
  if (escape) text = escapeEscape(text);
// text === "foo\\\\_bar"
  if (heading) text = escapeHeading(text);
  if (bulletedList) text = escapeBulletedList(text);
  if (numberedList) text = escapeNumberedList(text);
  if (maskedLink) text = escapeMaskedLink(text);

Regressed by #8701
Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes

Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
@vercel
Copy link

vercel bot commented Oct 30, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Nov 19, 2022 at 9:02PM (UTC)
discord-js-guide ⬜️ Ignored (Inspect) Nov 19, 2022 at 9:02PM (UTC)

@KevinNovak
Copy link
Contributor

Thanks for working on this! Looking forward to the merge!

@JPBM135
Copy link
Contributor

JPBM135 commented Oct 30, 2022

Shouldn't tests be changed? Or add tests for this?

@kodiakhq kodiakhq bot merged commit d6873b7 into discordjs:main Nov 19, 2022
@RedGuy12 RedGuy12 deleted the escape-escapes branch November 19, 2022 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

7 participants