From 8d1e36540ac5de7a338ae2692d69af049e911025 Mon Sep 17 00:00:00 2001 From: zhaobingshuang <1475195565@qq.com> Date: Wed, 17 Dec 2025 13:58:05 +0800 Subject: [PATCH] fix: detect_file_encodings TypeError: tuple indices must be integers or slices, not str (#29595) Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> --- api/core/rag/extractor/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/core/rag/extractor/helpers.py b/api/core/rag/extractor/helpers.py index 5166c0c768..5b466b281c 100644 --- a/api/core/rag/extractor/helpers.py +++ b/api/core/rag/extractor/helpers.py @@ -45,6 +45,6 @@ def detect_file_encodings(file_path: str, timeout: int = 5, sample_size: int = 1 except concurrent.futures.TimeoutError: raise TimeoutError(f"Timeout reached while detecting encoding for {file_path}") - if all(encoding["encoding"] is None for encoding in encodings): + if all(encoding.encoding is None for encoding in encodings): raise RuntimeError(f"Could not detect encoding for {file_path}") - return [FileEncoding(**enc) for enc in encodings if enc["encoding"] is not None] + return [enc for enc in encodings if enc.encoding is not None]