fix(api): return 4xx not 500 when attachment blob is missing by dripsmvcp · Pull Request #15509 · infiniflow/ragflow (original) (raw)
Bot added size:XS
This PR changes 0-9 lines, ignoring generated files.
Something isn't working, pull request that fix bug.
labels
[](/apps/coderabbitai)
The test stubbed quart and api.utils.api_utils with an incomplete name set, so loading agent_api.py raised ImportError (cannot import name 'Response' / 'validate_request') before any assertion ran — the regression was never actually exercised. Complete the stubs (Response/jsonify, validate_request as an identity decorator factory, pagination_utils, common.constants, common.misc_utils with an async thread_pool_exec, peewee, and STORAGE_IMPL on common.settings) and make stub modules lenient so a future agent_api.py import addition can't silently disable the test again.
Continue Integration
label
The sys.modules stubs guarantee only that agent_api.py imports; in the full test environment 'from common import settings' bound the real common.settings (STORAGE_IMPL=None) instead of the stub, so download_attachment 500'd with "'NoneType' object has no attribute 'get'" and all three cases failed in ragflow_tests. Override the module globals download_attachment reads after exec_module so behaviour is identical in the bare-stub (local) and full-dependency (CI) environments.
This PR changes 10-29 lines, ignoring generated files.
and removed size:XS
This PR changes 0-9 lines, ignoring generated files.
labels
[](/apps/coderabbitai)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})