Page MenuHomePhabricator

Detect the MIME type of large files by examining the first chunk
ClosedPublic

Authored by epriestley on Jun 30 2016, 8:33 PM.
Tags
None
Referenced Files
F15411853: D16204.diff
Wed, Mar 19, 10:03 AM
Unknown Object (File)
Feb 11 2025, 12:20 PM
Unknown Object (File)
Feb 10 2025, 6:46 PM
Unknown Object (File)
Feb 9 2025, 1:54 AM
Unknown Object (File)
Feb 9 2025, 1:54 AM
Unknown Object (File)
Feb 9 2025, 1:54 AM
Unknown Object (File)
Feb 5 2025, 3:36 PM
Unknown Object (File)
Feb 1 2025, 4:04 AM
Subscribers
None

Details

Summary

Fixes T11242. See that task for detailed discussion.

Previously, it didn't particularly matter that we don't MIME detect chunked files since they were all just big blobs of junk (PSDs, zips/tarballs, whatever) that we handled uniformly.

However, videos are large and the MIME type also matters.

  • Detect the overall mime type by detecitng the MIME type of the first chunk. This appears to work properly, at least for video.
  • Skip mime type detection on other chunks, which we were performing and ignoring. This makes uploading chunked files a little faster since we don't need to write stuff to disk.
Test Plan

Uploaded a 50MB video locally, saw it as chunks with a "video/mp4" mime type, played it in the browser in Phabricator as an embedded HTML 5 video.

Screen Shot 2016-06-30 at 1.32.37 PM.png (1×1 px, 279 KB)

Diff Detail

Repository
rP Phabricator
Branch
mimehead
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 12854
Build 16384: Run Core Tests
Build 16383: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to Detect the MIME type of large files by examining the first chunk.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Jun 30 2016, 8:57 PM
This revision was automatically updated to reflect the committed changes.