fix(api): return 4xx not 500 when attachment blob is missing by dripsmvcp · Pull Request #15509 · infiniflow/ragflow (original) (raw)

@dripsmvcp

@dosubot Bot added size:XS

This PR changes 0-9 lines, ignoring generated files.

🐞 bug

Something isn't working, pull request that fix bug.

labels

Jun 2, 2026

[coderabbitai[bot]](/apps/coderabbitai)

@dripsmvcp

…nfiniflow#15509)

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.

@wangq8 wangq8 added the ci

Continue Integration

label

Jun 11, 2026

@wangq8

@dripsmvcp

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.

buua436

@wangq8

@dosubot dosubot Bot added size:S

This PR changes 10-29 lines, ignoring generated files.

and removed size:XS

This PR changes 0-9 lines, ignoring generated files.

labels

Jun 15, 2026

@wangq8

[coderabbitai[bot]](/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 }})