Homec4science

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

Authored by epriestley <git@epriestley.com> on Jun 30 2016, 22:26.

Description

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

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.

{F1706837}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11242

Differential Revision: https://secure.phabricator.com/D16204

Details

Committed
epriestley <git@epriestley.com>Jun 30 2016, 22:57
Pushed
aubortJan 31 2017, 17:16
Parents
rPH7a315780b4fe: When using the "Close as Duplicate" relationship action, limit the UI to 1 task
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH01862b8f23ac: Detect the MIME type of large files by examining the first chunk (authored by epriestley <git@epriestley.com>).Jun 30 2016, 22:57