workaround for weird mime name encoding by evolution

This commit is contained in:
SJ 2013-03-23 19:14:36 +01:00
parent 31d801da6f
commit 6930fe66a8
2 changed files with 12 additions and 1 deletions

View File

@ -453,7 +453,7 @@ class ModelSearchMessage extends Model {
$attachment = $this->get_attachment($query->row['piler_id'], $query->row['attachment_id']); $attachment = $this->get_attachment($query->row['piler_id'], $query->row['attachment_id']);
return array('filename' => $query->row['name'], 'piler_id' => $query->row['piler_id'], 'attachment' => $attachment); return array('filename' => fix_evolution_mime_name_crap($query->row['name']), 'piler_id' => $query->row['piler_id'], 'attachment' => $attachment);
} }
} }
@ -471,6 +471,7 @@ class ModelSearchMessage extends Model {
if(!isset($query->rows)) { return array(); } if(!isset($query->rows)) { return array(); }
foreach($query->rows as $q) { foreach($query->rows as $q) {
$q['name'] = fix_evolution_mime_name_crap($q['name']);
array_push($data, $q); array_push($data, $q);
} }

View File

@ -474,4 +474,14 @@ function convert_days_ymd($convert) {
} }
function fix_evolution_mime_name_crap($s = '') {
if(preg_match("/iso\-\d{1,4}\-\d{1,}\'\'/i", $s)) {
$s = preg_replace("/iso\-\d{1,4}\-\d{1,}\'\'/i", "", $s);
$s = utf8_encode(urldecode($s));
}
return $s;
}
?> ?>