Fix: LFI vulnerability in document parsing API (#13196)

### What problem does this PR solve?

Fix LFI vulnerability in document parsing API.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Yongteng Lei
2026-02-25 09:47:39 +08:00
committed by GitHub
parent f4cbdc3a3b
commit 72b89304c1
2 changed files with 19 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ from rag.nlp import find_codec
def get_text(fnm: str, binary=None) -> str:
txt = ""
if binary:
if binary is not None:
encoding = find_codec(binary)
txt = binary.decode(encoding, errors="ignore")
else: