HomePhorge

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

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

Provenance
epriestleyAuthored on Jun 30 2016, 1:26 PM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rP7a315780b4fe: When using the "Close as Duplicate" relationship action, limit the UI to 1 task
Branches
Unknown
Tags
Unknown

Event Timeline