You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2014-01-30 18:10:13

mmacdonald2
Member
Registered: 2014-01-30
Posts: 5

GLPI 83.8 Documents corrupting when downloaded

When Office files (.doc, .docx, .xlsx) are downloaded from tickets they become corrupt.  They are uploaded fine.  I have checked by pulling them off the server via scp.   I have checked permissions and everything is owned by apache.

Server OS: Centos 6.3
Running Apache 2.2.15

Offline

#2 2014-01-31 13:00:12

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,278

Re: GLPI 83.8 Documents corrupting when downloaded

Are documents pulling for server the same as document in GLPI ? (exactly the same number of octets ?)


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#3 2014-01-31 15:20:56

mmacdonald2
Member
Registered: 2014-01-30
Posts: 5

Re: GLPI 83.8 Documents corrupting when downloaded

How would I check the correct number of octets?

Last edited by mmacdonald2 (2014-02-03 16:16:00)

Offline

#4 2014-02-04 14:23:58

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,278

Re: GLPI 83.8 Documents corrupting when downloaded

You pull your document from your server (glpi/files/xxx/xxx)
you pull your document from GLPI
you compare the size of two files


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#5 2014-02-04 15:41:46

mmacdonald2
Member
Registered: 2014-01-30
Posts: 5

Re: GLPI 83.8 Documents corrupting when downloaded

Just did the check with a file that was 127kb when uploaded.  And it was 127kb when scp'ed off and when downloaded from the ticket but it was corrupted when downloaded.

Offline

#6 2014-02-12 16:48:55

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

I see the same problem.
I uploaded a file and then i uploaded the same file in ZIP archive. ZIPped file is not damaged - i can download it and open. File inside ZIP archive has 15401 bytes. Non-zipped file (damaged) downloaded from GLPI has 15402 bytes! This one byte is added at the beggining of file - it's hex 0A.
I confirm that documents on the server are OK. This 0A byte is NOT added on the beginning of file. This is being added during download from glpi GUI.

Update:
Downloaded ZIP archive also has 0A added on the beginning of file but it looks like my unpacker can handle such damage and opens the archive.
This started to happen after upgrade to 0.84.4 - previously i had 0.83.xx (don't remember exact version number).

Last edited by marcinr (2014-02-12 18:03:13)

Offline

#7 2014-02-19 14:18:57

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

I'm surprised that this problem still isn't fixed. Come one, devs! Every file downloaded from glpi has one byte added on the beginning (0A)! This may not be visible because most PDF/ZIP viewers can handle it. It's best to test it on Microsoft Office files - Office will report an error during opening. Or just open downloaded file in hex editor.
Files on the server are ok!

Offline

#8 2014-02-26 10:58:22

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: GLPI 83.8 Documents corrupting when downloaded

We do not reproduce the trouble the it is difficult to fix it.
Have you plugins ? Have you do changes on GLPI files ?


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#9 2014-02-26 15:29:08

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

I only have "OCS Inventory NG" plugin. It's stock glpi 0.84.4 (after upgrade from 0.83.x).

Offline

#10 2014-03-05 10:44:57

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

BUMP

How the hell only "mine" glpi 0.84.4 can be adding one byte on the beginning of every file during download?? Two different installs on two different servers...

Last edited by marcinr (2014-03-05 10:52:44)

Offline

#11 2014-03-05 11:28:05

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

This is a simple txt file uploaded to glpi:
This is a test.
Hex: 54 68 69 73 20 69 73 20 61 20 74 65 73 74 2E

I download it back from glpi and in hex it is:
0A 54 68 69 73 20 69 73 20 61 20 74 65 73 74 2E

How the hell you can't see the same behaviour?!

Offline

#12 2014-03-05 12:08:09

ddurieux
Plugins Dev
From: Propières, France
Registered: 2005-06-17
Posts: 7,521

Re: GLPI 83.8 Documents corrupting when downloaded

Try remove all folders in glpi/plugins/ and see if it work or not

Offline

#13 2014-03-05 14:50:56

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

On one of my servers i had an old an unused plugin behaviors - i removed it and clicked Clean in /front/plugin.php
Nothing changed - still 0A byte is being added to every file downloaded from GLPI hmm

Offline

#14 2014-03-07 10:05:23

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

My servers:
CentOS release 5.9 (Final)  php-5.3.27-2.w5
CentOS release 6.5 (Final) php-5.3.3-27.el6_5.x86_64

Offline

#15 2014-03-11 20:36:20

mmacdonald2
Member
Registered: 2014-01-30
Posts: 5

Re: GLPI 83.8 Documents corrupting when downloaded

I recently updated to 84.4 and the problem still occurs.  I have 6 plugins installed: FusionInventory, Print to pdf, Projects, Reports, Themes Manager, and Web Services.  I also have another instance of glpi running with the same plugins, but it does not have this problem.

Offline

#16 2014-03-17 12:53:14

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

@mmacdonald2
What glpi version you've got on the 2nd server where you don't see this problem?

Offline

#17 2014-03-18 14:56:03

mmacdonald2
Member
Registered: 2014-01-30
Posts: 5

Re: GLPI 83.8 Documents corrupting when downloaded

marcinr wrote:

@mmacdonald2
What glpi version you've got on the 2nd server where you don't see this problem?

I am running the same version currently on both.  I am also running the same plugins on both.  I see the problem on our production server but not on our dev server.

Offline

#18 2014-04-29 13:02:49

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

@devs
I've updated to glpi 0.84.5 and the same bug still exists!
Is it going to be fixed at all?!

Offline

#19 2014-04-29 13:10:43

manal el harti
Member
Registered: 2014-04-25
Posts: 2

Re: GLPI 83.8 Documents corrupting when downloaded

bonjour .. je voudrais savoir ou je devrais définir le contenu d'un onglet du plugin

Offline

#20 2014-05-04 17:47:56

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,278

Re: GLPI 83.8 Documents corrupting when downloaded

Merci de' créer un post pour vos propres questions et ne pas vous associer à un poste n'ayant pas le même objet (ni la même langue).


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#21 2014-05-13 10:53:52

marcinr
Member
Registered: 2007-09-13
Posts: 49

Re: GLPI 83.8 Documents corrupting when downloaded

Got it! Please apply this patch to solve problems with corrupted file downloads!

--- inc/document2.class.php     2014-05-13 10:51:48.000000000 +0200
+++ inc/document.class.php      2014-05-13 10:49:47.000000000 +0200
@@ -400,8 +400,10 @@ class Document extends CommonDBTM {
       header('Cache-control: private, must-revalidate'); /// IE BUG + SSL
       header("Content-disposition: filename=\"".$this->fields['filename']."\"");
       header("Content-type: ".$this->fields['mime']);
-
+      ob_clean();
+      flush();
       readfile($file) or die ("Error opening file $file");
+      exit;
    }

Last edited by marcinr (2014-05-13 11:01:18)

Offline

#22 2015-02-17 13:11:32

jserrano
Member
Registered: 2015-02-17
Posts: 1

Re: GLPI 83.8 Documents corrupting when downloaded

For me the solution was:

- Edit the config_db.php
- Delete the last blank space.
- Save the config_db.php

Regards, Juan.

Offline

#23 2015-10-01 23:35:50

kpcomp
Member
Registered: 2008-07-12
Posts: 57

Re: GLPI 83.8 Documents corrupting when downloaded

Hello, what is the status of this problem?
I have same one.

- version 0.85.4
- no plugins and no code modifications
- any xlsx is offered to download as zip
- when saved and manually named as xlsx it works flawlesly (so no file corruption)
- looks like bad file header / mime type is sent out (xlsx actually is zipped file)
- problem started few versions back, not sure which one was first

Offline

#24 2015-10-14 16:26:54

kpcomp
Member
Registered: 2008-07-12
Posts: 57

Re: GLPI 83.8 Documents corrupting when downloaded

Found to be a MIME type problem.

Some of my xlsx and docx documents were misdetected as zip files.
(which they actually are too - they are compressed)

Add MIME type to File types of docx, pptx and xlsx based on
http://blogs.msdn.com/b/vsofficedevelop … types.aspx

And in document management replace misdetected MIME for all docx, pptx and xlsx.

Then it will work correctly.
Pavel

Offline

Board footer

Powered by FluxBB