Skip to content

fix(api): handle suffix and out-of-bounds video ranges - #1620

Open
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:fix/video-range-requests
Open

Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:fix/video-range-requests

Conversation

@1aifanatic

Copy link
Copy Markdown

Summary

Video requests with a range extending past EOF advertised more bytes than storage returned, while suffix requests were ignored and unsatisfiable ranges reached storage with invalid offsets. Parse complete single-byte-range specifications, clamp end offsets, and support suffix/open-ended ranges.

For a 17-byte recording, bytes=10-999 now returns bytes 10–16, bytes=-5 returns bytes 12–16, and bytes=17- returns 416 with Content-Range: bytes */17 without a storage download. Unsupported units, malformed headers, and multipart ranges receive the complete 200 response.

Testing

  • 40 video route tests cover both request-level and attempt-level endpoints; 16 cases failed before the fix.
  • Node 22.23.3 / pnpm 10.29.1: pnpm exec vitest run apps/api --maxWorkers=2 — 809 passed, including the OpenAPI snapshot.
  • pnpm --filter api exec tsc --noEmit — passed.
  • Regenerated the website OpenAPI artifact from the production registry.
  • Website: pnpm test — 20 passed; SITE=https://microsoft.github.io BASE_PATH=/scope pnpm run build — passed, 227 pages.
  • git diff --check — passed.

Documentation and compatibility

Updated the API architecture documentation and both committed OpenAPI artifacts to describe 416 responses. No dependencies or migrations.

Demos

N/A — HTTP/storage behavior; no Portal or CLI component change. Route tests verify response status, range headers, body bytes, and storage offsets.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant