[RCD] attaching files with russian filenames strips leading Cyrillic characters from the file

Zhang Huangbin zhbmaillistonly at gmail.com
Tue Sep 23 13:23:35 CEST 2008


A.L.E.C wrote:
> Dennis P. Nikolaenko wrote:
>   
>> Hello,
>> Please consider integrating the patch in ticket #1485267
>>   
>>     
>
> maybe in this way?:
>
> --- mime.old	2008-09-21 10:40:36.000000000 +0200
> +++ mime.php	2008-09-23 09:22:42.221738855 +0200
> @@ -350,7 +350,7 @@
>              $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 @@
>  
>                  $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,20 @@
>          }
>      }
>  
> -    
> +    /**
> +     * Get file's basename (locale independent) 
> +     *
> +     * @param string Filename
> +     *
> +     * @return string Basename
> +     * @access private
> +     */
> +    function _basename($filename)
> +    {
> +	if (stristr(PHP_OS, 'win') || stristr(PHP_OS, 'netware'))
> +	    return preg_replace('/^.*[\\\\\\/]/', '', $filename);
> +	else
> +	    return preg_replace('/^.*[\/]/', '', $filename);
> +    }
>  
>  } // End of class
>
>
>   
Hi, Alec.

It works with Chinese Simp characters filenames. Thanks very much.
Will it be merged into svn repository?
http://trac.roundcube.net/ticket/1485267#comment:27
_______________________________________________
List info: http://lists.roundcube.net/dev/



More information about the Dev mailing list