Author Topic: Corrupt attachments  (Read 4826 times)

Offline tschabet

  • Newbie
  • *
  • Posts: 3
Corrupt attachments
« on: June 09, 2010, 05:47:29 PM »
Hi!

There are already several topics in this Forum regarding this issue. I would like to underline it:

When I try to open word or excel attachments (maybe also other file types, I have not tested it) I get an error message from word or excel, asking that some converters need to be installed (which does not help at all) and only gives some garbage at the end. This issue appears on Linux Clients with Firefox as well as on Windows Clients with IE or FF clients. Always the same. Also, openoffice is not able to open these Word or Excel files.

PDF attachment or TXT attachements are working fine.

I cant believe that nobody has an idea or fixed this issue somehow. Without getting such attachments to work Roundcube is just not usable.

Thank you for any help!
Kind regards,
Thomas

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
Corrupt attachments
« Reply #1 on: June 09, 2010, 06:53:37 PM »
FWIW, I send and receive Word and Excel attachments via Roundcube frequently. No problems opening them.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline tschabet

  • Newbie
  • *
  • Posts: 3
Corrupt attachments
« Reply #2 on: June 10, 2010, 04:20:09 PM »
Now I made some test:
* save locally PDF attachment with Standard Mail client (Outlook)
* save locally DOC attachment with standard mail client (Outlook)
Then
* save locally PDF attachment with Roundcube Webmail
* save locally DOC attachment with Roundcube Webmail

What I found out is, that every attachment which come from Roundcube has 1 Byte more than saving it with Outlook or Thunderbird or KMail. I opened the files with a HEX editor and saw that the only difference is a "0A" at the very beginning of the file - in every cases.

The pdf viewer does not have a problem with this, it opens the file anyway. But Word or Excel seem to have problems with this "0A" Byte (which is a line feed). Removing this Byte enables Excel or Word to open the file properly.

Could anyone reproduce this? Has anyone of you an idea for a modification?

Kind regards,
Thomas

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,856
Corrupt attachments
« Reply #3 on: June 13, 2010, 12:47:11 PM »
What language are you using? could you check the labales and messages files in program/localization/[language]/ and see if there are any blank lines at the end? Also may be give 0.4b or SVN trunk a try and see if it still happens, there have been alot of changes since 0.3, what ever it was might have been fixed already.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline Granada

  • Jr. Member
  • **
  • Posts: 35
Corrupt attachments
« Reply #4 on: August 18, 2010, 10:55:18 AM »
We are currently experiencing the same problem on our new server. The problem must be apache and/or PHP related as other servers running RC0.4 don't show the problem. We are still searching for the reason RC does not remove the leading LF from the attachments. Attachments are by my knowledge being added to mails by adding a CRLF at the beginning of each file. Now RC removes the CR but not the LF and the attachments break up.

Server: IBM pSeries
OS: RHEL 5
PHP: 5.3.3

Regards
Ruediger

Offline Granada

  • Jr. Member
  • **
  • Posts: 35
Corrupt attachments
« Reply #5 on: August 19, 2010, 06:12:52 AM »
Problem solved!

one of the config-files of the plugins I have in use had a newline after the php end tag. That's so ... :stupid::stupid::stupid:

Regards
Ruediger

Offline alexz

  • Newbie
  • *
  • Posts: 1
Corrupt attachments
« Reply #6 on: October 07, 2010, 11:25:22 AM »
Just wanted to add some detail, this also fixed the problem for me.

(1) check all of these files

Code: [Select]
config/*
program/localization/[your locale]/*
plugins/*/config/*
plugins/*/localization/[your locale]/*

and remove trailing white space after the php close tag ?> ... i.e. there should be NO newline after the close tag.

(2) restart your web server.

----

notes:  sometimes plugins have config files in the root of the plugin directory not a config directory.  probably not necessary to change all those files but I didn't have time to isolate the problem.

This is so incredibly brain-dead, as if some evil sadist >:D was trying to make our code extra-brittle.  Not sure why this happens but I have seen it before with php - random bizarre problems due to the extra whitespace.  Most of the time doesn't seem to matter.  There must be a way to avoid it.  edit:  looks like this is not considered a bug http://trac.roundcube.net/ticket/1487000

Now if I could only figure out what's wrong with mime types (my browser doesn't want to open attachments, just save them)...
« Last Edit: October 07, 2010, 11:27:55 AM by alexz »