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
F14051233: D16204.diff
Thu, Nov 14, 11:06 PM
F14038043: D16204.diff
Sun, Nov 10, 9:10 PM
F14023562: D16204.diff
Thu, Nov 7, 2:45 AM
F13999022: D16204.id38977.diff
Thu, Oct 24, 12:25 PM
F13994303: D16204.id38979.diff
Wed, Oct 23, 5:14 AM
F13989778: D16204.diff
Mon, Oct 21, 10:59 PM
Unknown Object (File)
Oct 2 2024, 11:12 AM
Unknown Object (File)
Sep 21 2024, 1:42 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.