Skip to content

Conversation

Zabuzard
Copy link
Member

@Zabuzard Zabuzard commented Feb 10, 2023

Overview

Fixes and closes #766 .

Its about a bug in the logic for MessageUtils#extractCode, happens when the "end of the code" (indicated by 3 backticks) is before the end of the "language tag", i.e. like java.

Essentially, the closing code block should be found after the language tag, so indexOf(3 backticks, languageEnd) instead of at the start of it.

So I just moved the part down and now it works. Also added unit tests.

Details

As an example, consider the following message:

message

  • red: start of code fence
  • blue: end of code fence
  • green: language tag

Blue should only start after green, not before.

So the new order is:

  • find start of code fence
  • find language tag
  • find end of code fence

@Zabuzard Zabuzard added bug Something isn't working priority: normal labels Feb 10, 2023
@Zabuzard Zabuzard requested a review from a team as a code owner February 10, 2023 08:39
@Zabuzard Zabuzard self-assigned this Feb 10, 2023
@Zabuzard Zabuzard requested a review from a team as a code owner February 10, 2023 08:39
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Zabuzard Zabuzard merged commit 5c68607 into develop Feb 15, 2023
@Zabuzard Zabuzard deleted the bugfix/extract_code_oob branch February 15, 2023 12:29
@Zabuzard Zabuzard mentioned this pull request Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MessageUtils#extractCode out of bounds
2 participants