Skip to content

fix(markdownparser): ensure merged filenames unique#1006

Closed
sponge225 wants to merge 1 commit into
volcengine:mainfrom
sponge225:fix/markdownparser
Closed

fix(markdownparser): ensure merged filenames unique#1006
sponge225 wants to merge 1 commit into
volcengine:mainfrom
sponge225:fix/markdownparser

Conversation

@sponge225
Copy link
Copy Markdown
Collaborator

@sponge225 sponge225 commented Mar 26, 2026

Description

导入 Markdown( ov add-resource )时,若文档中存在大量重复同名标题(例如重复的顶级 # ... ), MarkdownParser 会把多个“小节”合并输出为 *_Nmore.md

旧的合并命名策略在 count > 1 时仅使用 {first}_{count}more ,在“重复标题 + 多次 merge 批次”场景下会产生同名文件,导致解析阶段写入覆盖/内容丢失

Related Issue

Closes #1004

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

仅调整合并文件命名逻辑: count > 1 时在 {first}_{count}more 后追加基于合并内容的短 hash(8 位),生成 {first}_{count}more_{hash8} ,确保不同合并批次的输出文件名稳定且唯一。

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 26, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@qin-ctx
Copy link
Copy Markdown
Collaborator

qin-ctx commented Mar 26, 2026

solve by #1005

@qin-ctx qin-ctx closed this Mar 26, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Mar 26, 2026
@sponge225 sponge225 deleted the fix/markdownparser branch May 6, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: MarkdownParser:重复顶级标题导致 merged 文件名冲突覆盖,入库文档缺失内容

3 participants