Skip to content

[P2][OCR] Serve media attachment ranges without full-file reads #52

Description

@Ryder-Sun

Source: OCR_ANALYSIS_REPORT.md, OpenCode Review report generated on 2026-08-12.

Findings: M-6, L-4, L-5. Attachment preview/range paths can read whole media files into memory for partial HTTP range requests, importBuffer() writes then reads bytes back for preview generation, and MP3 frame detection is looser than it should be.

Expected fix:

  • Use bounded fs.createReadStream range reads for media protocol requests.
  • Avoid unnecessary disk rereads after importBuffer() when bytes are already available.
  • Tighten MP3 frame validation.
  • Add tests for partial media range reads and media type detection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:p2Platform expansion after core runtime work

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions