Skip to content

Commit 0685d0d

Browse files
JihaoXinclaude
andcommitted
_find_pdf: only return paper/main.pdf, not template sample PDFs
Was returning any .pdf in paper/ dir — picked up acmart.pdf, NeurIPS.pdf, sample-sigconf.pdf etc. from venue templates. New projects showed "View PDF" button before any paper was generated. Now only returns main.pdf if it exists and is >10KB (real paper). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a775bfe commit 0685d0d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ark/webapp/routes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,10 @@ def _read_project_model(project_dir: Path) -> str:
471471

472472

473473
def _find_pdf(project_dir: Path) -> Optional[Path]:
474-
paper_dir = project_dir / "paper"
475-
for pdf in sorted(paper_dir.glob("*.pdf"), key=lambda p: p.stat().st_mtime, reverse=True):
476-
return pdf
474+
"""Find the generated paper PDF. Only returns main.pdf (not template/sample PDFs)."""
475+
main_pdf = project_dir / "paper" / "main.pdf"
476+
if main_pdf.exists() and main_pdf.stat().st_size > 10000: # >10KB = real paper, not empty
477+
return main_pdf
477478
return None
478479

479480

0 commit comments

Comments
 (0)