feat: continue roadmap acceptance work

This commit is contained in:
ik
2026-09-20 15:17:21 +07:00
parent d438c40542
commit b0edae98c6
19 changed files with 547 additions and 50 deletions
+17 -3
View File
@@ -49,12 +49,26 @@ def published_file(digest: str) -> tuple[Path, str] | None:
return None
manifest = json.loads((MEDIA_ROOT / "manifest.json").read_text(encoding="utf-8"))
item = next((row for row in manifest.get("assets", []) if row.get("status") == "approved" and row.get("sha256") == digest), None)
if not item:
media_type = None
local_path = None
if item:
media_type = item.get("content_type")
local_path = item.get("local_path")
else:
for row in manifest.get("assets", []):
if row.get("status") != "approved":
continue
variant = next((candidate for candidate in row.get("derivatives", []) if candidate.get("sha256") == digest), None)
if variant:
media_type = variant.get("content_type")
local_path = variant.get("local_path")
break
if not local_path:
return None
target = (MEDIA_ROOT / item["local_path"]).resolve()
target = (MEDIA_ROOT / local_path).resolve()
if not target.is_relative_to(MEDIA_ROOT.resolve()) or not target.is_file():
return None
return target, str(item["content_type"])
return target, str(media_type or "application/octet-stream")
def review_assets(entity_type: str | None = None, status: str | None = None) -> list[dict]: