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)
Thu, Mar 21, 6:04 AM
Unknown Object (File)
Feb 21 2024, 8:22 PM
Unknown Object (File)
Feb 21 2024, 8:22 PM
Unknown Object (File)
Feb 15 2024, 6:19 AM
Unknown Object (File)
Feb 14 2024, 7:53 AM
Unknown Object (File)
Feb 7 2024, 3:12 PM
Unknown Object (File)
Feb 3 2024, 11:09 AM
Unknown Object (File)
Jan 30 2024, 10:24 PM
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.