Commit 78605215 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Stop unknown file types being detected as audio files (bug #829136)

Commit d6446942

 created a new audio file type with a list of indexes
into the mimetype table for audio mimetypes.  However, the numeric keys
of the 'descriptions' array were being used to fetch audio mimetpes
instead of the values, which resulted in files with undetected
'application/octet-stream' mimetypes becoming audio artefacts after
upload.

Change-Id: I418fc8b864088269fcddcffcb56346e8f9bb78ee
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent aff1ab49
......@@ -2287,7 +2287,6 @@ class ArtefactTypeVideo extends ArtefactTypeFile {
class ArtefactTypeAudio extends ArtefactTypeFile {
public static function new_audio($data) {
$descriptions = self::audio_file_descriptions();
$validtypes = self::audio_mime_types();
if (isset($validtypes[$data->filetype])) {
return new ArtefactTypeAudio(0, $data);
......@@ -2316,7 +2315,7 @@ class ArtefactTypeAudio extends ArtefactTypeFile {
static $mimetypes = null;
if (is_null($mimetypes)) {
$descriptions = self::audio_file_descriptions();
$mimetypes = PluginArtefactFile::get_mimetypes_from_description(array_keys($descriptions), true);
$mimetypes = PluginArtefactFile::get_mimetypes_from_description($descriptions, true);
}
return $mimetypes;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment