minor fix to prevent null bytes from breaking sync
This commit is contained in:
+1
-1
@@ -387,7 +387,7 @@ async def _index_file(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Upsert one file: doc row + chunk rows + embeddings, one transaction."""
|
"""Upsert one file: doc row + chunk rows + embeddings, one transaction."""
|
||||||
settings = llm.settings
|
settings = llm.settings
|
||||||
content = full_path.read_text(encoding="utf-8", errors="replace")
|
content = full_path.read_text(encoding="utf-8", errors="replace").replace("\x00", "")
|
||||||
digest = hashlib.sha256(content.encode("utf-8")).hexdigest()
|
digest = hashlib.sha256(content.encode("utf-8")).hexdigest()
|
||||||
doc = session.scalar(select(Document).where(Document.source == source, Document.path == rel))
|
doc = session.scalar(select(Document).where(Document.source == source, Document.path == rel))
|
||||||
if doc is not None and doc.content_hash == digest:
|
if doc is not None and doc.content_hash == digest:
|
||||||
|
|||||||
Reference in New Issue
Block a user