A pipe in a DOCX table cell becomes a column separator in the extracted Markdown
まだ誰も着手していません。
評価
調査の方向性
Start at WordExtractor._table_to_markdown, using the DOCX table reproduction in the issue to inspect how cell content is joined into Markdown rows. Compare the handling with core/rag/extractor/excel_extractor.py, then verify that the rendered table preserves the pipe as cell content and that the accompanying tests pass.
索引モデルが issue の本文から書いたものです。
説明
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Dify version
main (38f9d85d5a)
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
Add a .docx to a knowledge base that contains a table where a cell holds a | character. A pipe is ordinary content in a table cell: a regular expression (a|b), an "and/or" shorthand, a shell pipeline in a documentation table, or P(A|B) in a statistics table.
Two-column table:
| Name | Pattern |
|---|---|
| alternation | a|b |
WordExtractor._table_to_markdown renders it by joining the cells:
markdown.append("| " + " | ".join(headers) + " |")
markdown.append("| " + " | ".join(["---"] * total_cols) + " |")
for row in table.rows[1:]:
row_cells = self._parse_row(row, image_map, total_cols)
markdown.append("| " + " | ".join(row_cells) + " |")
Reproduced directly against the renderer:
>>> extractor = WordExtractor.__new__(WordExtractor)
>>> print(extractor._table_to_markdown(Document("t.docx").tables[0], {}))
| Name | Pattern |
| --- | --- |
| alternation | a|b |
✔️ Expected Behavior
The pipe inside the cell is escaped, so the row describes the same two columns as the header:
| Name | Pattern |
| --- | --- |
| alternation | a\|b |
❌ Actual Behavior
The cell's pipe is emitted as a column separator, so the last row claims three columns where the header declares two. From that row on, the table is misaligned: a renderer that trims to the header width drops the trailing cell, and a model reading the chunk sees a and b as two separate columns rather than one value.
Nothing fails and nothing is logged — the output is still a syntactically valid Markdown table, just not the table the document contains.
core/rag/extractor/excel_extractor.py already escapes the structural character of the format it emits — value.replace('"', '\\"'), in three places, so a quote inside a cell cannot corrupt the row — which is what makes the Markdown table renderer look like an oversight rather than a decision.
I have a fix and tests ready and will open a PR referencing this issue.
Transparency: this report was prepared with AI assistance. The reproduction above was run against the extractor at 38f9d85d5a and the output is copied verbatim from that run.
- 主要言語
- TypeScript
- スター
- 157k
- フォーク
- 24.7k
- 平均マージ
- 22時間 32分
- マージ済み PR(30日)
- 611
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
langgenius/dify のほかの issue
-
Annotation Reply: a stored score threshold of 0.0 is silently replaced with 1, disabling the feature オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
langgenius/dify#42639 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
langgenius/dify#42468 · コメント 1 件 · リアクション 1 件 ·
-
🐞 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
langgenius/dify#42446 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
langgenius/dify#42355 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
langgenius/dify#42350 · コメント 1 件 · リアクション 1 件 ·
langgenius/dify の issue をすべて見る
似ている issue
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Automattic/studio#4908 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100