diff options
-rw-r--r-- | CHANGELOG | 4 | ||||
-rw-r--r-- | program/lib/Mail/mime.php | 21 |
2 files changed, 22 insertions, 3 deletions
@@ -1,6 +1,10 @@ CHANGELOG RoundCube Webmail --------------------------- +2008/09/25 (alec) +---------- +- Fix problem with non-ascii attachment names in Mail_mime (#1485267, #1485096) + 2008/09/23 (alec) ---------- - Fix language autodetection (#1485401) diff --git a/program/lib/Mail/mime.php b/program/lib/Mail/mime.php index 92c797b28..7641b0c9b 100644 --- a/program/lib/Mail/mime.php +++ b/program/lib/Mail/mime.php @@ -350,7 +350,7 @@ class Mail_mime $err = PEAR::raiseError($msg); return $err; } - $filename = substr('s_'.basename($filename), 2); + $filename = $this->_basename($filename); if (PEAR::isError($filedata)) { return $filedata; } @@ -667,7 +667,7 @@ class Mail_mime $this->_htmlbody = preg_replace($regex, $rep, $this->_htmlbody); $this->_html_images[$key]['name'] = - substr(basename('s_'.$this->_html_images[$key]['name']), 2); + $this->_basename($this->_html_images[$key]['name']); } } @@ -1114,6 +1114,21 @@ class Mail_mime } } - + /** + * Get file's basename (locale independent) + * + * @param string Filename + * + * @return string Basename + * @access private + */ + function _basename($filename) + { + // basename() is not unicode safe and locale dependent + if (stristr(PHP_OS, 'win') || stristr(PHP_OS, 'netware')) + return preg_replace('/^.*[\\\\\\/]/', '', $filename); + else + return preg_replace('/^.*[\/]/', '', $filename); + } } // End of class |