YAML URL import rewrites GitHub user-attachments links #21211

Closed
opened 2026-02-21 20:11:27 -05:00 by yindo · 1 comment
Owner

Originally created by @laipz8200 on GitHub (Dec 22, 2025).

Originally assigned to: @laipz8200 on GitHub.

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 @ 3322e7a7e3 (2025-12-22)

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. Open “Import DSL” and choose YAML URL.
  2. Use a GitHub user-attachments URL like https://github.com/user-attachments/files/24290802/loop-test.yml.
  3. Start the import.
  4. Observe the request is rewritten to https://raw.githubusercontent.com/user-attachments/files/24290802/loop-test.yml and returns 404.

✔️ Expected Behavior

GitHub user-attachments URLs should be fetched as-is. Only repository blob URLs like https://github.com/<org>/<repo>/blob/<branch>/<path>.yml should be rewritten to raw URLs.

Actual Behavior

The import rewrites any github.com URL to raw.githubusercontent.com, which breaks user-attachments links.

Originally created by @laipz8200 on GitHub (Dec 22, 2025). Originally assigned to: @laipz8200 on GitHub. ## Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ## Dify version main @ 3322e7a7e3 (2025-12-22) ## Cloud or Self Hosted Self Hosted (Source) ## Steps to reproduce 1. Open “Import DSL” and choose YAML URL. 2. Use a GitHub user-attachments URL like `https://github.com/user-attachments/files/24290802/loop-test.yml`. 3. Start the import. 4. Observe the request is rewritten to `https://raw.githubusercontent.com/user-attachments/files/24290802/loop-test.yml` and returns 404. ## ✔️ Expected Behavior GitHub `user-attachments` URLs should be fetched as-is. Only repository blob URLs like `https://github.com/<org>/<repo>/blob/<branch>/<path>.yml` should be rewritten to raw URLs. ## ❌ Actual Behavior The import rewrites any `github.com` URL to `raw.githubusercontent.com`, which breaks `user-attachments` links.
yindo added the 🐞 bug label 2026-02-21 20:11:27 -05:00
yindo closed this issue 2026-02-21 20:11:27 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 22, 2025):

This is a confirmed bug: the YAML URL import logic rewrites any GitHub URL ending with .yml or .yaml to raw.githubusercontent.com, regardless of whether it's a repository blob or a user-attachments link. This happens in both import_app (api/services/app_dsl_service.py) and import_rag_pipeline (api/services/rag_pipeline/rag_pipeline_dsl_service.py) and causes user-attachments URLs to break with 404 errors because they are not valid raw URLs. The code does not currently distinguish between repo blob URLs and user-attachments URLs, leading to this issue (source 1, source 2).

To fix this, update the URL rewriting logic to only rewrite URLs that match the repository blob pattern (github.com/<org>/<repo>/blob/<branch>/<path>) and leave other GitHub URLs, like user-attachments, unchanged. Consider centralizing this logic in a helper function for maintainability, since both services use nearly identical code. It's also a good idea to add or update tests to ensure blob URLs are rewritten and user-attachments URLs are not, to prevent regressions.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 22, 2025): <!-- Answer --> This is a confirmed bug: the YAML URL import logic rewrites any GitHub URL ending with `.yml` or `.yaml` to `raw.githubusercontent.com`, regardless of whether it's a repository blob or a user-attachments link. This happens in both `import_app` (api/services/app_dsl_service.py) and `import_rag_pipeline` (api/services/rag_pipeline/rag_pipeline_dsl_service.py) and causes user-attachments URLs to break with 404 errors because they are not valid raw URLs. The code does not currently distinguish between repo blob URLs and user-attachments URLs, leading to this issue ([source 1](https://github.com/langgenius/dify/blob/3322e7a7e3b456148003c8fe48bc8aed7fe18152/api/services/app_dsl_service.py#L153-L183), [source 2](https://github.com/langgenius/dify/blob/3322e7a7e3b456148003c8fe48bc8aed7fe18152/api/services/rag_pipeline/rag_pipeline_dsl_service.py#L150-L158)). To fix this, update the URL rewriting logic to only rewrite URLs that match the repository blob pattern (`github.com/<org>/<repo>/blob/<branch>/<path>`) and leave other GitHub URLs, like user-attachments, unchanged. Consider centralizing this logic in a helper function for maintainability, since both services use nearly identical code. It's also a good idea to add or update tests to ensure blob URLs are rewritten and user-attachments URLs are not, to prevent regressions. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/defe9992-0299-43cd-8543-f078e6af69d6?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/defe9992-0299-43cd-8543-f078e6af69d6?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/defe9992-0299-43cd-8543-f078e6af69d6?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/defe9992-0299-43cd-8543-f078e6af69d6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/defe9992-0299-43cd-8543-f078e6af69d6?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/defe9992-0299-43cd-8543-f078e6af69d6?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/defe9992-0299-43cd-8543-f078e6af69d6?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20confirmed%20bug%3A%20the%20YAML%20URL%20import%20logic%20rewrites%20any%20GitHub%20URL%20ending%20with%20%60.yml%60%20or%20%60.yaml%60%20to%20%60raw.githubusercontent.com%60%2C%20regardless%20of%20whether%20it%27s%20a%20repository%20blob%20or%20a%20user-attachments%20link.%20This%20happens%20in%20both%20%60import_app%60%20%28api/services/app_dsl_service.py%29%20and%20%60import_rag_pipeline%60%20%28api/services/rag_pipeline/rag_pipeline_dsl_service.py%29%20and%20causes%20user-attachments%20URLs%20to%20break%20with%20404%20errors%20because%20they%20are%20not%20valid%20raw%20URLs.%20The%20code%20does%20not%20currently%20distinguish%20between%20repo%20blob%20URLs%20and%20user-attachments%20URLs%2C%20leading%20to%20this%20issue%20%28%5Bsource%201%5D%28https%3A//github.com/langgenius/dify/blob/3322e7a7e3b456148003c8fe48bc8aed7fe18152/api/services/app_dsl_service.py%23L153-L183%29%2C%20%5Bsource%202%5D%28https%3A//github.com/langgenius/dify/blob/3322e7a7e3b456148003c8fe48bc8aed7fe18152/api/services/rag_pipeline/rag_pipeline_dsl_service.py%23L150-L158%29%29.%0A%0ATo%20fix%20this%2C%20update%20the%20URL%20rewriting%20logic%20to%20only%20rewrite%20URLs%20that%20match%20the%20repository%20blob%20pattern%20%28%60github.com/%3Corg%3E/%3Crepo%3E/blob/%3Cbranch%3E/%3Cpath%3E%60%29%20and%20leave%20other%20GitHub%20URLs%2C%20like%20user-attachments%2C%20unchanged.%20Consider%20centralizing%20this%20logic%20in%20a%20helper%20function%20for%20maintainability%2C%20since%20both%20services%20use%20nearly%20identical%20code.%20It%27s%20also%20a%20good%20idea%20to%20add%20or%20update%20tests%20to%20ensure%20blob%20URLs%20are%20rewritten%20and%20user-attachments%20URLs%20are%20not%2C%20to%20prevent%20regressions.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30002)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21211