Spaces:
Sleeping
Sleeping
Commit History
-
Audit-driven hardening: upload caps, registry quota, SSE timeout, OCR escape
ClaudeFive small fixes from the security/bug sweep, all scoped to the existing no-auth single-user deploy model: - Cap upload size: stream UploadFile to disk in chunks and abort past 500 MB (video) / 5 MB (transcript). Replaces the unbounded shutil.copyfileobj that an anon caller could exploit to fill the Space's RAM/disk. - Cap concurrent jobs: JobRegistry.create() now purges stale entries and evicts the oldest finished entry; if the registry is still at MAX_LIVE_JOBS=8 with all of them running, raises JobQuotaExceeded which the /jobs endpoint surfaces as 429. - SSE generator no longer pings forever when a worker thread dies silently — bails out (and emits a terminal error event) after 30 min of running-but-event-less. - /ocr endpoint dedupes parallel cache writes via dict.setdefault, so two simultaneous picks of the same alt don't both run Tesseract and fight over the result. - text_format._render_block escapes the LaTeX it injects into the ocr-equation paragraph; th…7c2d809
-
Format on-screen OCR text into paragraphs, lists, and inline LaTeX
ClaudeRaw Tesseract output rendered as a single string lost all structure. The new text_format module splits OCR text into blocks and emits proper HTML: - blank-line-separated blocks become <p> - bullet/ordered prefixes become <ul>/<ol> - lines that look like equations (short, contain =, Greek, math symbols, sub/superscripts, few alphabetic words) are normalized to LaTeX and wrapped in MathJax \(...\) MathJax is auto-loaded when any segment's OCR has detected math, so no template changes are needed beyond the new format_ocr Jinja filter. Equation detection is intentionally conservative — misfires render as plain paragraphs and reviewers can fix in the editor.2f21b14