About base_url in _extract_images_from_docx method of word_extractor.py #12918

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

Originally created by @rainsoft on GitHub (Apr 15, 2025).

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

v1.2.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

In the _extract_images_from_docx method of word_extractor.py, when processing images, the returned URLs currently use CONSOLE_API_URL. Should they be standardized to use the FILE_URLS configuration instead?

✔️ Expected Behavior

image_map[rel.target_part] = (
    f"![image]({dify_config.FILES_URL}/files/{upload_file.id}/file-preview)"
)

Actual Behavior

image_map[rel.target_part] = (
    f"![image]({dify_config.CONSOLE_API_URL}/files/{upload_file.id}/file-preview)"
)
Originally created by @rainsoft on GitHub (Apr 15, 2025). ### 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 v1.2.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce In the _extract_images_from_docx method of word_extractor.py, when processing images, the returned URLs currently use CONSOLE_API_URL. Should they be standardized to use the FILE_URLS configuration instead? ### ✔️ Expected Behavior ```python image_map[rel.target_part] = ( f"![image]({dify_config.FILES_URL}/files/{upload_file.id}/file-preview)" ) ``` ### ❌ Actual Behavior ```python image_map[rel.target_part] = ( f"![image]({dify_config.CONSOLE_API_URL}/files/{upload_file.id}/file-preview)" ) ```
yindo closed this issue 2026-02-21 19:09:40 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 15, 2025):

The issue you're encountering involves the use of CONSOLE_API_URL instead of FILES_URL for constructing image URLs in the _extract_images_from_docx method.

The FILES_URL is specifically intended for file handling, providing the prefix for file preview or download URLs, and is used to display these URLs in the front-end. It also ensures security by signing image preview URLs, which expire after a set time [1].

Switching from CONSOLE_API_URL to FILES_URL for image URLs in this context seems appropriate, as FILES_URL is designed for file-related operations. This change would align the URL usage with its intended purpose, potentially improving both functionality and security by using the correct configuration for file access.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 15, 2025): <!-- Answer --> The issue you're encountering involves the use of `CONSOLE_API_URL` instead of `FILES_URL` for constructing image URLs in the `_extract_images_from_docx` method. The `FILES_URL` is specifically intended for file handling, providing the prefix for file preview or download URLs, and is used to display these URLs in the front-end. It also ensures security by signing image preview URLs, which expire after a set time <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/environments.md)</sup>. Switching from `CONSOLE_API_URL` to `FILES_URL` for image URLs in this context seems appropriate, as `FILES_URL` is designed for file-related operations. This change would align the URL usage with its intended purpose, potentially improving both functionality and security by using the correct configuration for file access. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/fa1d85bc-5925-4255-82f2-f4eab410892e?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/fa1d85bc-5925-4255-82f2-f4eab410892e?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/fa1d85bc-5925-4255-82f2-f4eab410892e?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/fa1d85bc-5925-4255-82f2-f4eab410892e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fa1d85bc-5925-4255-82f2-f4eab410892e?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/fa1d85bc-5925-4255-82f2-f4eab410892e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/fa1d85bc-5925-4255-82f2-f4eab410892e?feedback_type=other)</sup>
Author
Owner

@rainsoft commented on GitHub (Apr 20, 2025):

had merged, close!

@rainsoft commented on GitHub (Apr 20, 2025): had merged, close!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12918