Skip to content

fix(upload): accept valid videos with generic or empty MIME types (#1475) - #1817

Open
Tarulatapriya wants to merge 1 commit into
reframe-oss:mainfrom
Tarulatapriya:fix/generic-mime-uploads
Open

Tarulatapriya wants to merge 1 commit into
reframe-oss:mainfrom
Tarulatapriya:fix/generic-mime-uploads

Conversation

@Tarulatapriya

Copy link
Copy Markdown
Contributor

Summary

Fixes #1475

Valid video files dropped or picked via OS file pickers or certain browsers sometimes come with empty ("") or generic MIME types (application/octet-stream, application/x-matroska). Previously, both useVideoEditor and FileUpload strictly required file.type.startsWith("video/"), causing valid videos to be rejected before magic byte inspection could verify them.

Changes

  • src/hooks/useVideoEditor.ts:
    • Allowed files with valid video extensions (.mp4, .mov, .avi, .webm, .mkv) and generic/empty MIME types ("", application/octet-stream, application/x-matroska) through Layer 1 and Layer 2 validation into Layer 3 (magic byte verification).
  • src/components/FileUpload.tsx:
    • Updated upload drop/selection validation to accept valid video extensions with generic or empty MIME types.
    • Added common extensions (.mp4,.mov,.avi,.webm,.mkv) to the file input's accept attribute alongside video/*.
  • src/hooks/tests/useVideoEditor.test.ts:
    • Added unit tests verifying acceptance of valid video extensions with empty/generic MIME types and rejection of non-video files.
    • Cleared test history state in beforeEach to prevent query param test leakage.

Testing

  • npm run test / vitest (all tests passing)
  • npx tsc --noEmit (clean)
  • npm run lint (clean)
  • npm run build (clean)

@netlify

netlify Bot commented Oct 18, 2026

Copy link
Copy Markdown

👷 Deploy request for reframe-os pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 760bc49

@github-actions github-actions Bot added level:intermediate Intermediate level - 35 pts type:bug Bug fix type:testing Testing labels Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Format Check Passed — @Tarulatapriya

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @Tarulatapriya!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. ✅ Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

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

level:intermediate Intermediate level - 35 pts type:bug Bug fix type:testing Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Uploader rejects valid videos with generic MIME types

1 participant