Roundcube Community Forum

 

Serious problem with attachements being broken !

Started by dbucher, August 19, 2008, 11:43:30 AM

Previous topic - Next topic

dbucher

Hello,

I have installed Roundcube and everything works perfectly excepts that... it corrupts attachements ! Attachements are sent but the file is invalid when received by anyone...

The only error in the logs doesn't seem to be a big problem :
 [Tue Aug 19 17:14:22 2008] [error] [client 62.147.237.26] PHP Warning:  dl() [function.dl]: Unable to load dynamic library '/usr/lib/php5/extensions/fileinfo.so' - /usr/lib/php5/extensions/fileinfo.so: cannot open shared object file: No such file or directory in /srv/www/htdocs/roundcube/program/include/rcube_shared.inc on line 701, referer: https://www.domain.com/webmail/?_task=mail&_action=compose

What should I do to debug/understand this problem ?

The received file is smaller (8k instead of 64k)

Thanks a lot in advance for your help !

dbucher

Hello everyone,

sorry to insist my my problem, but if someone had a solution it would really be great.

Not being able to send file-attachs is really blocking and I really don't understand where the problem comes from (bug ?)

Thanks a lot in advance for your help !

JohnDoh

RC is attempting to load the fileInfo extension so it can find out what sort of file the attachment is. The extension is optional so if it is not there RC should just carry on with out it. I guess the problem could be that the path to your extensions dir is wrong or there is something wrong with the fileinfo.so or that there is a bug in RC and it is not handleing the extension not being there correctly (but I suspect this would have come up more if that was true).
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

dbucher

Hello,

Yes thank you, I think it's optional too...

And I think I've found the problem, it's a bug in RC, it uses php fread() that is limited to 8kb !
But I don't find where in the source to correct it...

Everything seems to be explained on this link... EXCEPT the solution !
* http://trac.roundcube.net/ticket/1484880

Thanks a lot for your help !

Denis

JohnDoh

The solution is there too, changeset linked at the bottom. Try the latest SVN and see if the problem still exists.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

dbucher

#5
Hello !

Yes you're right it's under http://trac.roundcube.net/changeset/1631

On the three files, I corrected two files :

1. trunk/roundcubemail/program/include/rcube_mdb2.php
#DEBUG-REMOVED    $data = '';
#DEBUG-REMOVED    if ($fd = fopen($file_name, 'r'))
#DEBUG-REMOVED      {
#DEBUG-REMOVED      $data = fread($fd, filesize($file_name));
#DEBUG-REMOVED      fclose($fd);
#DEBUG-REMOVED      }
// line added according to :
// selon http://trac.roundcube.net/changeset/1631
$data = file_get_contents($file_name);

2.  program/lib/html2text.inc
    function set_html( $source, $from_file = false )
    {
#DEBUG-REMOVED        $this->html = $source;

        if ( $from_file && file_exists($source) ) {
#DEBUG-REMOVED            $fp = fopen($source, 'r');
#DEBUG-REMOVED            $this->html = fread($fp, filesize($source));
#DEBUG-REMOVED            fclose($fp);
#DEBUG-REMOVED        }
$this->html = file_get_contents($source);
}
else
$this->html = $source;

        $this->_converted = false;
    }

3. I didn't found a file like trunk/roundcubemail/program/include/rcube_template.php in my 0.1.1 version ? But it seems to be program/include/rcmail_template.inc :

      // include a file
      case 'include':
        $path = realpath($this->config['skin_path'].$attrib['file']);
#DEBUG-REMOVED        if (filesize($path))
 if (is_readable($path)) {
#DEBUG-REMOVED        {
          if ($this->config['skin_include_php'])
            $incl = $this->include_php($path);
#DEBUG-REMOVED          else if ($fp = @fopen($path, 'r'))
#DEBUG-REMOVED          {
#DEBUG-REMOVED            $incl = fread($fp, filesize($path));
#DEBUG-REMOVED            fclose($fp);
else {
$incl = file_get_contents($path);
          }
          return $this->parse_xml($incl);
        }
        break;


4. I see that file upload is now functional : temporary file in /tmp has the correct size of 69kb :
# ls -ltr /tmp/  | tail -n 1
-rw------- 1 wwwrun       www   672768 Aug 17 17:21 rcmAttmnt3ubnlu

5. But the sent attached file is still 8kb ??? Help ! ;-)

Thanks a lot for any further help !

Denis

JohnDoh

There have been a lot of changes between the 0.1.1 release and r1631 (0.1.1 was r1259 I think). Really I think the only thing you can do is it download the latest SVN and try it. Sorry I dont know what else to suggest.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

dbucher

Yes but I fear that installing an alpha version will have more problems... I have 50 people using roundcube and removing one bug to have many other is quite dangerous...

What do you think ?

dbucher


Wazooka

I'm using 0.2 alpha and managed to attach/send a 2.5 meg MP3 without issues. A 6 mb file was giving trouble. But I don't think mailboxes aregenerally happy with huge files anyways. Just visit your fellows more often :)