Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: detect_file_encodings TypeError: tuple indices must be integers or slices, not str (#29595)

zhaobingshuang8d1e36540ac5
diff --git a/api/core/rag/extractor/helpers.py b/api/core/rag/extractor/helpers.py
index 5166c0c768a..5b466b281c4 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]