diff --git a/src/applications/files/config/PhabricatorFilesConfigOptions.php b/src/applications/files/config/PhabricatorFilesConfigOptions.php index 43e12eddec..063a6d9138 100644 --- a/src/applications/files/config/PhabricatorFilesConfigOptions.php +++ b/src/applications/files/config/PhabricatorFilesConfigOptions.php @@ -1,183 +1,216 @@ 'image/jpeg', 'image/jpg' => 'image/jpg', 'image/png' => 'image/png', 'image/gif' => 'image/gif', 'text/plain' => 'text/plain; charset=utf-8', 'text/x-diff' => 'text/plain; charset=utf-8', // ".ico" favicon files, which have mime type diversity. See: // http://en.wikipedia.org/wiki/ICO_(file_format)#MIME_type 'image/x-ico' => 'image/x-icon', 'image/x-icon' => 'image/x-icon', 'image/vnd.microsoft.icon' => 'image/x-icon', - 'audio/x-wav' => 'audio/x-wav', + // This is a generic type for both OGG video and OGG audio. 'application/ogg' => 'application/ogg', - 'audio/mpeg' => 'audio/mpeg', + + 'audio/x-wav' => 'audio/x-wav', + 'audio/mpeg' => 'audio/mpeg', + 'audio/ogg' => 'audio/ogg', + + 'video/mp4' => 'video/mp4', + 'video/ogg' => 'video/ogg', + 'video/webm' => 'video/webm', ); $image_default = array( 'image/jpeg' => true, 'image/jpg' => true, 'image/png' => true, 'image/gif' => true, 'image/x-ico' => true, 'image/x-icon' => true, 'image/vnd.microsoft.icon' => true, ); + + // The "application/ogg" type is listed as both an audio and video type, + // because it may contain either type of content. + $audio_default = array( - 'audio/x-wav' => true, + 'audio/x-wav' => true, + 'audio/mpeg' => true, + 'audio/ogg' => true, + + // These are video or ambiguous types, but can be forced to render as + // audio with `media=audio`, which seems to work properly in browsers. + // (For example, you can embed a music video as audio if you just want + // to set the mood for your task without distracting viewers.) + 'video/mp4' => true, + 'video/ogg' => true, + 'application/ogg' => true, + ); + + $video_default = array( + 'video/mp4' => true, + 'video/ogg' => true, + 'video/webm' => true, 'application/ogg' => true, - 'audio/mpeg' => true, ); // largely lifted from http://en.wikipedia.org/wiki/Internet_media_type $icon_default = array( // audio file icon 'audio/basic' => 'fa-file-audio-o', 'audio/L24' => 'fa-file-audio-o', 'audio/mp4' => 'fa-file-audio-o', 'audio/mpeg' => 'fa-file-audio-o', 'audio/ogg' => 'fa-file-audio-o', 'audio/vorbis' => 'fa-file-audio-o', 'audio/vnd.rn-realaudio' => 'fa-file-audio-o', 'audio/vnd.wave' => 'fa-file-audio-o', 'audio/webm' => 'fa-file-audio-o', // movie file icon 'video/mpeg' => 'fa-file-movie-o', 'video/mp4' => 'fa-file-movie-o', + 'application/ogg' => 'fa-file-movie-o', 'video/ogg' => 'fa-file-movie-o', 'video/quicktime' => 'fa-file-movie-o', 'video/webm' => 'fa-file-movie-o', 'video/x-matroska' => 'fa-file-movie-o', 'video/x-ms-wmv' => 'fa-file-movie-o', 'video/x-flv' => 'fa-file-movie-o', // pdf file icon 'application/pdf' => 'fa-file-pdf-o', // zip file icon 'application/zip' => 'fa-file-zip-o', // msword icon 'application/msword' => 'fa-file-word-o', // msexcel 'application/vnd.ms-excel' => 'fa-file-excel-o', // mspowerpoint 'application/vnd.ms-powerpoint' => 'fa-file-powerpoint-o', ) + array_fill_keys(array_keys($image_default), 'fa-file-image-o'); // NOTE: These options are locked primarily because adding "text/plain" // as an image MIME type increases SSRF vulnerability by allowing users // to load text files from remote servers as "images" (see T6755 for // discussion). return array( $this->newOption('files.viewable-mime-types', 'wild', $viewable_default) ->setLocked(true) ->setSummary( pht('Configure which MIME types are viewable in the browser.')) ->setDescription( pht( "Configure which uploaded file types may be viewed directly ". "in the browser. Other file types will be downloaded instead ". "of displayed. This is mainly a usability consideration, since ". "browsers tend to freak out when viewing enormous binary files.". "\n\n". "The keys in this map are viewable MIME types; the values are ". "the MIME types they are delivered as when they are viewed in ". "the browser.")), $this->newOption('files.image-mime-types', 'set', $image_default) ->setLocked(true) ->setSummary(pht('Configure which MIME types are images.')) ->setDescription( pht( 'List of MIME types which can be used as the `%s` for an `%s` tag.', 'src', '')), $this->newOption('files.audio-mime-types', 'set', $audio_default) ->setLocked(true) ->setSummary(pht('Configure which MIME types are audio.')) ->setDescription( pht( - 'List of MIME types which can be used to render an `%s` tag.', + 'List of MIME types which can be rendered with an `%s` tag.', '