← Back to team overview

mahara-contributors team mailing list archive

[Bug 1318995] A change has been merged

 

Reviewed:  https://reviews.mahara.org/3774
Committed: http://gitorious.org/mahara/mahara/commit/61e2e7941dede54fca063ca2942b3d925186e889
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch:    1.10_STABLE

commit 61e2e7941dede54fca063ca2942b3d925186e889
Author: Robert Lyon <robertl@xxxxxxxxxxxxxxx>
Date:   Thu Sep 25 07:58:37 2014 +1200

Getting old extension when unzipping a .tar file (Bug #1318995)

Change-Id: Ib77c0970d6f1e0d3248b58744349b49447d7c413
Signed-off-by: Robert Lyon <robertl@xxxxxxxxxxxxxxx>

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1318995

Title:
  File import of zipped PDF does not detect filetype correctly

Status in Mahara ePortfolio:
  Fix Committed
Status in Mahara 1.7 series:
  Fix Committed
Status in Mahara 1.8 series:
  Fix Committed
Status in Mahara 1.9 series:
  Fix Committed

Bug description:
  In Mahara 1.9.0

  After building a portfolio export button for the Moodle certificate
  module using MNet, I found that the PDF file was getting saved with
  the mimetype set to application/x-director. This turned out to be
  because the import process does not correctly pass through the file
  extension.

  In import/file/lib.php, around line 108 in the add_artefacts()
  function is a call to ArtefactTypeFile::save_file(). The $data does
  not include and $oldextension attribute, but this is expected later on
  around line 947 of artefact/file/lib.php in the new_file() function.
  The following line throws an error:

  $data->guess = file_mime_type($path, "foo.{$data->oldextension}");

  And then file_mime_type() fails because it doesn't know what the
  extension is.

  To fix it, the following chunk of code works nicely:

          if (isset($data->oldextension)) {
              $originalfilename = "foo.{$data->oldextension}";
          } else {
              $originalfilename = false;
          }
          $data->guess = file_mime_type($path, $originalfilename);

  This causes the original filename to be read from the file object.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1318995/+subscriptions


References