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

Properly escape quotes with leading spaces #2363

Merged
merged 4 commits into from
May 20, 2023

Conversation

Almighty-Satan
Copy link
Contributor

Pull Request Etiquette

Changes

  • Internal code
  • Library interface (affecting end-user code)
  • Documentation
  • Other: _____

Closes Issue: #2358

Description

Fixes an issue that caused quotes with leading spaces to not be escaped.

@SurfyDevelopment
Copy link

I've tested this, it seems like it escapes everything coming after the input string aswell, could you check?

@Almighty-Satan
Copy link
Contributor Author

I've tested this, it seems like it escapes everything coming after the input string aswell, could you check?

I don't really understand what you mean by that. Could you please elaborate a bit?

@SurfyDevelopment
Copy link

SurfyDevelopment commented Jan 5, 2023

Basically, what I am doing is:

Convert the markdown from Telegram for an automatic Discord message (announcement)

I am doing so by escaping the text and then convert the Telegram entities into Discord markdown.

ORIGINAL MESSAGE:
image

ESCAPING PRESENT DISCORD MARKDOWN ON THAT TEXT:
image

DEBUG ENTITIES:
image

Entitites get converted into discord markdown

OUTPUT STRING:
image

As you can see, in the output string everything was not being converted

Note:

This is how it gets sent on 5.0.0-beta2
image

@SurfyDevelopment
Copy link

SurfyDevelopment commented Jan 5, 2023

After some more debugging I found out that the problem is that the escape actually replaces one space char instead of just adding the \ right before the quote, as shown:

ORIGINAL:
image

ESCAPED:
image

This is what ends up breaking my converter, the chars basically just don't add up.

@Almighty-Satan
Copy link
Contributor Author

After some more debugging I found out that the problem is that the escape actually replaces one space char instead of just adding the \ right before the quote, as shown:

ORIGINAL: image

ESCAPED: image

This is what ends up breaking my converter, the chars basically just don't add up.

I think that should be fixed now

@Almighty-Satan Almighty-Satan marked this pull request as ready for review January 6, 2023 09:47
@SurfyDevelopment
Copy link

Tested, I can confirm it does in fact work properly now

DEBUG MESSAGE AFTER ESCAPING + CONVERSION:
image

@DV8FromTheWorld
Copy link
Member

This needs tests.

@MinnDevelopment MinnDevelopment merged commit 2e2653e into discord-jda:master May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants