Skip to content

Fix: add compatibility route for document download under /v1 - #14663

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
buua436:b039
May 8, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
buua436:b039

Conversation

@buua436

@buua436 buua436 commented May 8, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

add compatibility route for document download under /v1

Type of change

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

@coderabbitai

coderabbitai Bot commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds backward-compatibility support for a deprecated document download endpoint (GET /v1/document/download/{attachment_id}). The implementation includes a new Flask blueprint with a route handler that logs deprecation and forwards requests to the current document API, plus corresponding API documentation updates.

Changes

Backward-Compatible Document Download Endpoint

Layer / File(s) Summary
Blueprint Declaration & Route Handler
api/apps/backward_compat.py
New document_download_manager Blueprint added (line 49) with route handler for GET /v1/document/download/<attachment_id> that logs deprecation and forwards to document_api.download_attachment (lines 438–455).
Blueprint Registration
api/apps/backward_compat.py
Blueprint registered on the Flask app with /v1 URL prefix in register_backward_compat_routes function (line 482).
API Documentation
docs/references/http_api_reference.md
"Download attachment" section corrected to reference deprecated endpoint as GET /v1/document/download/{doc_id} with migration guidance to GET /api/v1/documents/{doc_id}/download (lines 6884–6886).

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly Related PRs

  • infiniflow/ragflow#14583: Adds backward-compatible route handlers to the same api/apps/backward_compat.py module with similar deprecation forwarding pattern.

Suggested Labels

🐞 bug, lgtm

Suggested Reviewers

  • wangq8

Poem

🐰 A backward step forward, gracefully done,
Old paths now whisper where new ones run,
Endpoints deprecated with logs that shout,
Documentation corrected, no doubt about!
The compat layer grows, users transition smooth. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete, missing substantive details about the problem, impact, and implementation specifics required by the template. Expand the description to explain the underlying issue (why this compatibility route is needed), the impact of this change, and any relevant context for reviewers.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a compatibility route for document download under the /v1 endpoint.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

@buua436 buua436 added the ci Continue Integration label May 8, 2026
@buua436
buua436 requested a review from wangq8 May 8, 2026 06:03
@buua436
buua436 marked this pull request as ready for review May 8, 2026 06:03
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/references/http_api_reference.md`:
- Line 6885: The documented deprecated endpoint path uses the placeholder
`{doc_id}` but the compatibility route in code is
`/v1/document/download/{attachment_id}`; update the API reference entry for the
GET download endpoint to use `{attachment_id}` everywhere it appears (the
endpoint path and any inline examples/description) so the placeholder matches
the implemented route and avoids migration confusion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 308e5eb7-3096-4ea4-9ff1-3008a112e8f6

📥 Commits

Reviewing files that changed from the base of the PR and between a82ae4a and 3bf4568.

📒 Files selected for processing (2)
  • api/apps/backward_compat.py
  • docs/references/http_api_reference.md


:::caution DEPRECATED
The previous endpoint `GET /api/v1/document/download/{doc_id}` is deprecated. Please use this endpoint instead.
The previous endpoint `GET /v1/document/download/{doc_id}` is deprecated. Please use this endpoint instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use the same path parameter name as the compatibility route.

Line 6885 still says {doc_id}, but the compatibility endpoint added in code is /v1/document/download/{attachment_id}. Please align the placeholder to avoid migration confusion.

✏️ Suggested doc fix
-The previous endpoint `GET /v1/document/download/{doc_id}` is deprecated. Please use this endpoint instead.
+The previous endpoint `GET /v1/document/download/{attachment_id}` is deprecated. Please use this endpoint instead.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The previous endpoint `GET /v1/document/download/{doc_id}` is deprecated. Please use this endpoint instead.
The previous endpoint `GET /v1/document/download/{attachment_id}` is deprecated. Please use this endpoint instead.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/references/http_api_reference.md` at line 6885, The documented
deprecated endpoint path uses the placeholder `{doc_id}` but the compatibility
route in code is `/v1/document/download/{attachment_id}`; update the API
reference entry for the GET download endpoint to use `{attachment_id}`
everywhere it appears (the endpoint path and any inline examples/description) so
the placeholder matches the implemented route and avoids migration confusion.

@wangq8

wangq8 commented May 8, 2026

Copy link
Copy Markdown
Collaborator

LGTM

@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.16%. Comparing base (f703169) to head (3bf4568).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14663   +/-   ##
=======================================
  Coverage   94.16%   94.16%           
=======================================
  Files          10       10           
  Lines         703      703           
  Branches      112      112           
=======================================
  Hits          662      662           
  Misses         25       25           
  Partials       16       16           

☔ 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 d843035 into infiniflow:main May 8, 2026
1 check passed
pekar9781 pushed a commit to pekar9781/ragflow that referenced this pull request May 8, 2026
…low#14663)

### What problem does this PR solve?

add compatibility route for document download under /v1

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
Ricardo-M-L pushed a commit to Ricardo-M-L/ragflow that referenced this pull request Aug 17, 2026
…low#14663)

### What problem does this PR solve?

add compatibility route for document download under /v1

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants