Skip to content

Support unterminated markdown code blocks in cleaner#6645

Open
guanxuc wants to merge 1 commit into
spring-projects:mainfrom
guanxuc:fix-6641
Open

Support unterminated markdown code blocks in cleaner#6645
guanxuc wants to merge 1 commit into
spring-projects:mainfrom
guanxuc:fix-6641

Conversation

@guanxuc

@guanxuc guanxuc commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Description

MarkdownCodeBlockCleaner previously required both an opening and a
closing triple-backtick fence. Responses that omitted the closing
fence (common with truncated or streamed output) were returned
unchanged. The cleaner now strips the opening fence unconditionally
and only removes the closing fence when present, so unterminated
blocks such as ```json {"key": "value"} are cleaned correctly.

Related issue

  MarkdownCodeBlockCleaner previously required both an opening and a
  closing triple-backtick fence. Responses that omitted the closing
  fence (common with truncated or streamed output) were returned
  unchanged. The cleaner now strips the opening fence unconditionally
  and only removes the closing fence when present, so unterminated
  blocks such as ```json {"key": "value"} are cleaned correctly.

Signed-off-by: guanxu <1510424541@qq.com>
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.

MarkdownCodeBlockCleaner.clean() throws StringIndexOutOfBoundsException on degenerate fence-only input

2 participants