Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): indexer worker crash on unexpected markdown indent (#9210)

pengx170fdf2c490558
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();
}
}