Delete all URLs and email addresses option does not work when uploading Markdown documents #5019

Closed
opened 2026-02-21 18:09:01 -05:00 by yindo · 2 comments
Owner

Originally created by @Menghuan1918 on GitHub (Aug 13, 2024).

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.16

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  • Check Delete all URLs and email addresses option when uploading Markdown file
    图片
  • Wait for the file to be processed and view the text

✔️ Expected Behavior

When the uploaded text is in txt format and the same preprocessing rules are used, the URL link is preserved
图片

Actual Behavior

When the uploaded text was in md format and the same preprocessing rules were used, the URL links were all cleaned up
图片

Originally created by @Menghuan1918 on GitHub (Aug 13, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.16 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce - Check Delete all URLs and email addresses option when uploading Markdown file ![图片](https://github.com/user-attachments/assets/b235db75-17eb-4ae9-8703-3282712742ab) - Wait for the file to be processed and view the text ### ✔️ Expected Behavior When the uploaded text is in txt format and the same preprocessing rules are used, the URL link is preserved ![图片](https://github.com/user-attachments/assets/c8ecb5cd-3014-491b-a4c3-520c0b5c78de) ### ❌ Actual Behavior When the uploaded text was in md format and the same preprocessing rules were used, the URL links were all cleaned up ![图片](https://github.com/user-attachments/assets/594bf0a7-38ff-44af-84db-81f9ea74795c)
yindo added the 🐞 bug label 2026-02-21 18:09:01 -05:00
yindo closed this issue 2026-02-21 18:09:01 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 13, 2024):

@Menghuan1918 Hi there! I'm a bot that can help you solve bugs, answer questions, and become a contributor. I'm here to assist you while waiting for a human maintainer.

The "Delete all URLs and email addresses" option is not working correctly for Markdown files in Dify version 0.6.16 because the preprocessing rules for cleaning data, including deleting URLs and email addresses, may not be fully compatible or correctly implemented for Markdown files. The MarkdownExtractor class in the Dify codebase shows that there are specific methods for removing hyperlinks and images from Markdown content, but it does not explicitly handle email addresses.

def remove_hyperlinks(self, content: str) -> str:
    """Remove hyperlinks from markdown content."""
    pattern = r"\[(.*?)\]\((.*?)\)"
    content = re.sub(pattern, r"\1", content)
    return content

The remove_hyperlinks method only removes hyperlinks formatted in Markdown syntax but does not address email addresses. This suggests that the current implementation of the preprocessing rules might not be effectively parsing or recognizing email addresses within the Markdown syntax, leading to the observed issue [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 13, 2024): <!-- Greeting --> @Menghuan1918 Hi there! I'm a bot that can help you solve bugs, answer questions, and become a contributor. I'm here to assist you while waiting for a human maintainer. <!-- Answer --> The "Delete all URLs and email addresses" option is not working correctly for Markdown files in Dify version 0.6.16 because the preprocessing rules for cleaning data, including deleting URLs and email addresses, may not be fully compatible or correctly implemented for Markdown files. The `MarkdownExtractor` class in the Dify codebase shows that there are specific methods for removing hyperlinks and images from Markdown content, but it does not explicitly handle email addresses. ```python def remove_hyperlinks(self, content: str) -> str: """Remove hyperlinks from markdown content.""" pattern = r"\[(.*?)\]\((.*?)\)" content = re.sub(pattern, r"\1", content) return content ``` The `remove_hyperlinks` method only removes hyperlinks formatted in Markdown syntax but does not address email addresses. This suggests that the current implementation of the preprocessing rules might not be effectively parsing or recognizing email addresses within the Markdown syntax, leading to the observed issue <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/knowledge-base/create-knowledge-and-upload-documents.md)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/rag/extractor/markdown_extractor.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@devhero commented on GitHub (Oct 9, 2024):

same issue with .doc files, to fix I convert documents in pdf, but it's not a good solution.

@devhero commented on GitHub (Oct 9, 2024): same issue with .doc files, to fix I convert documents in pdf, but it's not a good solution.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5019