ragflow/api/apps
Mckennasora 9dd22e141b
fix: validate chunk type before processing to prevent AttributeError (#9698)
### What problem does this PR solve?

This PR fixes a critical bug in the session listing endpoint where the
application crashes with an `AttributeError` when processing chunk data
that contains non-dictionary objects.

**Error before fix:**
```json
{
  "code": 100,
  "data": null,
  "message": "AttributeError(\"'str' object has no attribute 'get'\")"
}
```

**Root cause:**
The code assumes all items in the `chunks` array are dictionary objects
and directly calls the `.get()` method on them. However, in some cases,
the chunks array contains string objects or other non-dictionary types,
causing the application to crash when attempting to call `.get()` on a
string.

**Solution:**
Added type validation to ensure each chunk is a dictionary before
processing. Non-dictionary chunks are safely skipped, preventing the
crash while maintaining functionality for valid chunk data.

This fix improves the robustness of the session listing endpoint and
ensures users can retrieve their conversation sessions without
encountering server errors due to data format inconsistencies.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-08-25 17:57:01 +08:00
..
auth Fix: use jwks_uri from OIDC metadata for JWKS client (#8136) 2025-06-10 10:16:58 +08:00
sdk fix: validate chunk type before processing to prevent AttributeError (#9698) 2025-08-25 17:57:01 +08:00
__init__.py Feat: add SMTP support for user invitation emails (#9479) 2025-08-15 18:12:20 +08:00
api_app.py Feat: add advanced document filter (#8723) 2025-07-09 09:33:11 +08:00
canvas_app.py Feat: add meta filter to search app. (#9554) 2025-08-19 17:25:44 +08:00
chunk_app.py Fix: no effect on retrieval_test in term of metadata filter. (#9566) 2025-08-19 18:57:35 +08:00
conversation_app.py Fix: no effect on retrieval_test in term of metadata filter. (#9566) 2025-08-19 18:57:35 +08:00
dialog_app.py Refa: create new name for duplicated dialog name (#9558) 2025-08-19 18:14:04 +08:00
document_app.py Feat: add meta data filter. (#9405) 2025-08-12 14:12:56 +08:00
file2document_app.py Feat: add advanced document filter (#8723) 2025-07-09 09:33:11 +08:00
file_app.py Refa: better MIME content type (#8801) 2025-07-11 18:47:19 +08:00
kb_app.py Feat: add meta data filter. (#9405) 2025-08-12 14:12:56 +08:00
langfuse_app.py Feat: add project_id and project_name to Langfuse API (#6481) 2025-03-25 10:36:34 +08:00
llm_app.py Refa: split services about llm. (#9450) 2025-08-13 16:41:01 +08:00
mcp_server_app.py Perf: Enhance timeout handling. (#8826) 2025-07-15 09:36:45 +08:00
plugin_app.py Feat: Support tool calling in Generate component (#7572) 2025-05-16 16:32:19 +08:00
search_app.py Fix: search service reference (#9533) 2025-08-18 19:02:10 +08:00
system_app.py Feat: Add user registration toggle feature (#6327) 2025-03-21 09:38:15 +08:00
tenant_app.py Feat: add SMTP support for user invitation emails (#9479) 2025-08-15 18:12:20 +08:00
user_app.py Trival. (#9460) 2025-08-14 09:39:00 +08:00