Commit f6a842af authored by Robert Lyon's avatar Robert Lyon
Browse files

Problem extracting leap2a zip file on import (Bug #1380434)



For some zip files for some users the mimetype is being interpreted as
"application/x-zip" (note the quotes are part of the string) so this
fails to map to the valid zip types and so the zip file is not
extracted.

So have trimmed the quote off the string

Change-Id: Ia58e3c3aa9a734172543b8c71ecab10a8f313b82
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 8af9e91e
...@@ -222,7 +222,7 @@ function adduser_validate(Pieform $form, $values) { ...@@ -222,7 +222,7 @@ function adduser_validate(Pieform $form, $values) {
$mimetype = file_mime_type($values['leap2afile']['tmp_name']); $mimetype = file_mime_type($values['leap2afile']['tmp_name']);
} }
else { else {
$mimetype = $values['leap2afile']['type']; $mimetype = trim($values['leap2afile']['type'], '"');
} }
$date = time(); $date = time();
$niceuser = preg_replace('/[^a-zA-Z0-9_-]/', '-', $values['username']); $niceuser = preg_replace('/[^a-zA-Z0-9_-]/', '-', $values['username']);
......
...@@ -124,7 +124,7 @@ function import_validate(Pieform $form, $values) { ...@@ -124,7 +124,7 @@ function import_validate(Pieform $form, $values) {
$mimetype = file_mime_type($values['leap2afile']['tmp_name']); $mimetype = file_mime_type($values['leap2afile']['tmp_name']);
} }
else { else {
$mimetype = $values['leap2afile']['type']; $mimetype = trim($values['leap2afile']['type'], '"');
} }
$date = time(); $date = time();
$niceuser = preg_replace('/[^a-zA-Z0-9_-]/', '-', $USER->get('username')); $niceuser = preg_replace('/[^a-zA-Z0-9_-]/', '-', $USER->get('username'));
......
Supports Markdown
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