ingestion: skip empty files instead of failing the run

This commit is contained in:
Paperclip Builder
2026-10-26 22:30:36 +11:00
parent 4e52015fd2
commit da674b5555

View File

@@ -271,6 +271,9 @@ def _file_document(result, client, guide, repo, branch, area, updated, created,
result.add_rejection(exclusions.Rejection(path, "gitea", "binary content", full_name))
return None
text = raw.decode("utf-8", "replace")
if not text.strip():
result.add_rejection(exclusions.Rejection(path, "gitea", "empty file", full_name))
return None
hits = exclusions.scan_text(text)
if hits:
kinds = sorted({hit[0] for hit in hits})
@@ -506,6 +509,9 @@ def _harvest_obsidian(result, client, guide, repos, vault_repo, tree, cfg, base_
result.add_rejection(exclusions.Rejection(path, "obsidian", "binary content"))
continue
text = raw.decode("utf-8", "replace")
if not text.strip():
result.add_rejection(exclusions.Rejection(path, "obsidian", "empty file"))
continue
hits = exclusions.scan_text(text)
if hits:
result.add_rejection(
@@ -517,6 +523,9 @@ def _harvest_obsidian(result, client, guide, repos, vault_repo, tree, cfg, base_
continue
fields, body = _split_note(text, validator)
if not body.strip():
result.add_rejection(exclusions.Rejection(path, "obsidian", "empty note"))
continue
title = str(fields.get("title") or _heading(body) or os.path.splitext(os.path.basename(path))[0])
tag_values = fields.get("tags") or []
if isinstance(tag_values, str):