Proper handling of ".ogg" files

Bug #1540654 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Son Nguyen

Bug Description

Son has found that Mahara doesn't currently handle ".ogg" files correctly. We have separate mappings for ".ogv" and ".oga" in the artefact_file_mime_types table, representing OGG video and OGG audio. But we don't have a mapping for ".ogg", which is a fairly common file extension on the internet, historically used by OGG video and OGG audio!

So, this gets passed to finfo->file() or mime_content_type(), both of which identify a ".ogg" as "application/ogg", making it inaccessible to either the audio player block or the video player block!

This puts us in a bind, because none of our available methods (file suffix, finfo, or mime_content_type) can determine whether these files are audio or video. The command-line Unix utility "mimetype" *can* distinguish them, but it's preferable not to bring more command-line utility execution into Mahara because it hurts portability.

Fortunately, there's an easy way out. According to Wikipedia, the ".ogg" suffix was used for both OGG video & OGG audio prior to 2007. After that, the Xiph foundation changed their recommendation so that ".ogg" should be used only for audio files. (See https://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions for the up-to-date list).

So, we should fix this issue as follows:

1. As an immediate fix, put a mapping in artefact_file_mime_types mapping ".ogg" to "ogg/audio".

2. As a longer-term fix, see if there are any all-PHP techniques (or maybe Javascript techniques we could use at the upgrade step?) to distinguish ogg/audio and ogg/video files based on their file content. (i.e., has anyone ported the "mimetype" utility to PHP?)

Son Nguyen (ngson2000)
Changed in mahara:
assignee: nobody → Son Nguyen (ngson2000)
status: Confirmed → In Progress
Revision history for this message
Son Nguyen (ngson2000) wrote :

There is a problem of adding a mapping in artefact_file_mime_types table as the map audio/ogg -> oga existed and the column 'mimetype' is an primary key.

I'd remove this constraint as a mimetype can have several description.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/6004

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6004
Committed: https://git.mahara.org/mahara/mahara/commit/bc07f998667d71347710886e637c07890e2e6e58
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit bc07f998667d71347710886e637c07890e2e6e58
Author: Son Nguyen <email address hidden>
Date: Thu Feb 4 09:15:44 2016 +1300

Enable OGG media. Bug 1540654

TODO: Currently a DB constraint on our mimetypes table
prevents us from having two file suffixes mapped to the
same mimetype, which means we can either support .ogg
or .oga files, but not both. Since .oga files are already
in our table, I'm going with that for now.

behatnotneeded

Change-Id: Ie364b111f7b4dc956712b179fefca6e76b23d5e9

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
tags: added: nominatedfeature
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/6316

Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.