Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Documents download ...
 
Notifications
Clear all

Documents download problem

15 Posts
2 Users
0 Reactions
14.7 K Views
Evgueni Kolossov
(@ekolossov)
Posts: 566
Contributor
Topic starter
 
[#536]

Hi,
New CRITICAL problem just found after last upgrade - when downloaded - document is corrupted and cannot be opened (Word offering to select encoding). we have checked log - there is nothing, we can open document directly from server, so document is not corrupted but download are not working for the most of the documents


 
Posted : 24 May 2012 14H11
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Hi,
Ticket #686 registered.

I tried to reproduce on Demo (Ticket #8 = Test for Ticket #686) :
- uploaded a doc file (including images)
- I could download the file and open it

Could you try and reproduce on Demo :
- download doc attacked to ticket #8 and open it
- upload a doc file from yours, download it and open it.

Other questions :
- did the issue occur on previous version, or did it appear with V2.2 ?
- did you have any change on your server ?

Thanks.


 
Posted : 24 May 2012 15H16
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Hi,

Sample file uploaded on document #9 :
- can be downloaded and opened without any issue

Your own file at the same place :
- can be downloaded, but cannot be opened
=> I check directly getting it from server : cannot be opened neither.
=> I'm afraid your file is corrupted at source.


 
Posted : 24 May 2012 16H35
Evgueni Kolossov
(@ekolossov)
Posts: 566
Contributor
Topic starter
 

No, it is not corrupted. I can open it from the source and from our server...


 
Posted : 24 May 2012 16H38
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Could you please try, on the Demo :
- upload simple text file as document version
- upload same simple text file as attachment
- upload pdf file as document version
- upload same pdf text file as attachment
- upload doc file as document version (already done)
- upload same doc text file as attachment
Thanks.

You also tell me that uploaded file, fetched from server : how did you fetch it from server : SFTP ? in Binary or text mode ?


 
Posted : 24 May 2012 17H14
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Very Strange.
It seems some UTF8 conversion has been applied.

What I did :
- download your file on Document #9 version 1.0
- open this doc with word : issue (request for conversion) :sick:
- open your doc with notepad, check encoding (= UTF8), change encoding to ANSI, save
- open this doc with word : OK :woohoo:
- upload this new doc as V3
- download the V3 doc, open it with word : OK :woohoo:

It seems that it is your upload that got wrong.
What browser are you using ? What version ?


 
Posted : 24 May 2012 22H23
Evgueni Kolossov
(@ekolossov)
Posts: 566
Contributor
Topic starter
 

I have tried with Firefox and IE - result id the same...
So somehow upload changing encoding to UTF-8


 
Posted : 25 May 2012 14H09
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Hi,

I worked on this issue and could not reproduce your upload issue.
I'm afraid I must be able to reproduce to find a workaround.

I also tried to change default encoding, but with no success.
Can you tell me what your encoding charset is ?
(on Firefox : Tools / Options / Content / Advanced button (on fonts) / encoding charset)
Thanks.


 
Posted : 30 May 2012 2H06
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Hi Evgueni,

I still try to fix this issue but whatever I try, I cannot reproduce.
- are you still facing the issue ?
- Can you tell me what your encoding charset is (on your browser configuration) ?
- on your first posts, you said the file was OK on server, but KO when downloading, but when you tried it on Demo, I got a wrong format on the server (with some UTF-8 translation), and after fixing on server, I could download OK. Could you confirm the diagnostic : file OK on server (error on download) of file KO on server (error on upload).

Thanks.


 
Posted : 05 Jun 2012 18H29
Evgueni Kolossov
(@ekolossov)
Posts: 566
Contributor
Topic starter
 

Default is Western (ISO-8859-1)


 
Posted : 06 Jun 2012 11H11
Evgueni Kolossov
(@ekolossov)
Posts: 566
Contributor
Topic starter
 

Ok, we have found and fixed the problem:
Added the ob_clean() and flush() command before the readfile in download.php
e.g., in tool/download.php
ob_clean();
flush();
readfile($file);
Now everything is OK - please implement into main stream
Regards,
Evgueni


 
Posted : 06 Jun 2012 15H07
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Hi,

Great you found a fixing !

I'll try it to include it in next version.
I want to investigate about the flush() method : not sure the result will be the same on Windows (flush does not immediatly sends result to browser) and Linux (flush immediatly sends result to browser). I'll test it before including it.

Many thanks.


 
Posted : 06 Jun 2012 15H42
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Hi,

You solution works fine on my windows environment, but fails on my Linux environment :

ERROR : ob_clean()
failed to delete buffer. No buffer to delete
in download.php
at line 51

It seems that ob_clean() fails on Linux if buffer is empty.
In your case, your server should add some extra characters that fills the buffer (leading to original download issue).
I fixed this way :

  if (ob_get_length()){   
    ob_clean();
  }
  flush();

This solution brings no regression for me. Tested :
- with Windows XP and Linux servers
- using browser : Chrome 19, Firefox 12 and IE 8
- downloading : ticket attachment file, document version file

Could you please test this solution and confirm that it still fixes the issue in your case ?
Thanks.


 
Posted : 06 Jun 2012 16H40
Evgueni Kolossov
(@ekolossov)
Posts: 566
Contributor
Topic starter
 

Used your code and still seems to work.
(Oddly enough we're running a linux server....)
Regards,
Evgueni


 
Posted : 06 Jun 2012 16H49
babynus
(@babynus)
Posts: 14957
Main Contributor Admin
 

Great !
So this fix will be included in V2.3


 
Posted : 06 Jun 2012 19H25
Share:

Scroll to Top