Skip to content

Fix: Correct the API path - #15204

Merged
wangq8 merged 3 commits into
infiniflow:mainfrom
wangq8:bugfix/correct-api-path
May 25, 2026
Merged

wangq8 merged 3 commits into
infiniflow:mainfrom
wangq8:bugfix/correct-api-path

Conversation

@wangq8

@wangq8 wangq8 commented May 25, 2026 •

Copy link
Copy Markdown
Collaborator

Follow on PR #15146 to reslove the backwad compatability issue.

  1. /agents/<attachment_id>/download -> /agents/attachments/<attachment_id>/download

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 34177271-96f4-4b8b-a46f-2e847fb1164f

📥 Commits

Reviewing files that changed from the base of the PR and between f8c626b and d6c3515.

📒 Files selected for processing (5)
  • api/apps/backward_compat.py
  • api/apps/restful_apis/agent_api.py
  • docs/references/http_api_reference.md
  • test/testcases/test_web_api/test_common.py
  • web/src/utils/api.ts

📝 Walkthrough

Walkthrough

The PR consolidates the attachment download endpoint by moving it from /agents/<attachment_id>/download to /agents/attachments/<attachment_id>/download. Backward-compatibility routes that previously used the documents API now forward to the new agent endpoint. Frontend code, test utilities, and API documentation are updated to match the new path.

Changes

Attachment Download Endpoint Consolidation

Layer / File(s) Summary
Endpoint routing refactor
api/apps/restful_apis/agent_api.py, api/apps/backward_compat.py
The agent download route is moved to /agents/attachments/<attachment_id>/download. The backward-compatibility module updates its deprecation list and two handlers (deprecated_document_download and document_download_v1) to forward requests to the new agent endpoint instead of the document API.
Frontend and test consumer updates
web/src/utils/api.ts, test/testcases/test_web_api/test_common.py
The frontend API utility getAttachmentFileDownload and test helper document_download are updated to use the new /agents/attachments/{id}/download path.
API documentation
docs/references/http_api_reference.md
The HTTP API reference documents the new endpoint GET /api/v1/agents/attachments/{attachment_id}/download, marks the prior /v1/document/download/* routes as deprecated, and provides updated curl examples and parameter documentation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • infiniflow/ragflow#14663: Updates backward-compatibility routing in api/apps/backward_compat.py for deprecated document/attachment download paths.
  • infiniflow/ragflow#14633: Changes backward-compatibility handlers in api/apps/backward_compat.py to forward attachment downloads to new RESTful handlers.
  • infiniflow/ragflow#15146: Modifies the agent attachment download route and related URL mappings in api/apps/restful_apis/agent_api.py.

Suggested labels

🐞 bug, size:S

Poem

🐰 A path was wandered through the code so fine,
From /agents/{id} to /agents/attachments inline,
Old routes now bow and gently redirect,
While tests and docs receive the same respect—
One endpoint truth, through all the threads it flows!

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the 'Type of change' section but lacks the required 'What problem does this PR solve?' section with background context. Add a 'What problem does this PR solve?' section explaining the backward compatibility issue being resolved and why the API path change was needed.
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fix: Correct the API path' is vague and generic, referring generally to 'the API path' without specifying which endpoint was corrected or why. Make the title more specific to clarify which API path was corrected, such as 'Fix: Correct agent attachments download endpoint path' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wangq8
wangq8 requested a review from buua436 May 25, 2026 06:21
@wangq8 wangq8 added the ci Continue Integration label May 25, 2026
@wangq8
wangq8 marked this pull request as ready for review May 25, 2026 06:21
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 25, 2026
@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.12%. Comparing base (5d022d8) to head (d6c3515).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15204   +/-   ##
=======================================
  Coverage   93.12%   93.12%           
=======================================
  Files          10       10           
  Lines         713      713           
  Branches      116      116           
=======================================
  Hits          664      664           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wangq8
wangq8 merged commit 4776bfa into infiniflow:main May 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant