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
Unknown Object (File)
Sat, Dec 14, 9:15 PM
Unknown Object (File)
Wed, Dec 11, 12:47 PM
Unknown Object (File)
Thu, Dec 5, 2:11 AM
Unknown Object (File)
Wed, Dec 4, 5:45 AM
Unknown Object (File)
Fri, Nov 29, 12:36 PM
Unknown Object (File)
Wed, Nov 27, 10:02 AM
Unknown Object (File)
Sat, Nov 23, 7:32 AM
Unknown Object (File)
Tue, Nov 19, 11:02 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.