Harden export preview handling
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-06-17 07:04:07 +02:00
parent 21b84dae6c
commit ff21911ac5
10 changed files with 111 additions and 15 deletions
+7
View File
@@ -192,6 +192,13 @@ class ExportService:
if not export:
raise AppError(code="EXPORT_NOT_FOUND", message="Export not found", status_code=404)
path = ExportService.get_export_download_path(db, export_id)
if export.export_type == "project_report_html" or path.suffix.lower() in {".html", ".htm"}:
raise AppError(
code="EXPORT_CONTENT_UNSUPPORTED",
message="Export content preview is only available for JSON and GeoJSON artifacts. Download HTML report artifacts instead.",
details={"export_type": export.export_type},
status_code=415,
)
try:
content = json.loads(path.read_text(encoding="utf-8"))
except json.JSONDecodeError as exc: