From 0fdf2c49055862b0373159db884280b7f6796ca3 Mon Sep 17 00:00:00 2001 From: pengx17 Date: Fri, 20 Dec 2024 02:08:44 +0000 Subject: [PATCH] fix(core): indexer worker crash on unexpected markdown indent (#9210) --- .../frontend/core/src/modules/docs-search/worker/in-worker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts b/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts index 067c503f14..f697e6f3d5 100644 --- a/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts +++ b/packages/frontend/core/src/modules/docs-search/worker/in-worker.ts @@ -433,7 +433,8 @@ function unindentMarkdown(markdown: string) { current = current.trimStart(); } else { // For subsequent list items, maintain relative indentation - current = ' '.repeat(indent - baseIndent) + current.trimStart(); + current = + ' '.repeat(Math.max(0, indent - baseIndent)) + current.trimStart(); } }