mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-23 01:18:22 +08:00
### What problem does this PR solve? Closes #15048. Several SDK session routes in `api/apps/sdk/session.py` called `.split()` directly on `request.headers.get("Authorization")`. When clients omitted the header, the handlers raised `AttributeError` before returning the existing `Authorization is not valid!` response. This PR centralizes SDK Authorization parsing in a small helper and keeps the existing error response for missing, empty, or malformed headers. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) ### Tests - `ZHIPU_AI_API_KEY=dummy uv run --python 3.13 --group test pytest test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py::test_sdk_session_routes_missing_authorization_unit -q` - `uv run --python 3.13 --group test ruff check api/apps/sdk/session.py test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py` - `python3 -m py_compile api/apps/sdk/session.py test/testcases/test_http_api/test_session_management/test_session_sdk_routes_unit.py` - `git diff --check`