Loading

Corrupt files after uploading

Get help with problems, or report & discuss bugs in Collabtive

Re: Corrupt files after uploading

Postby Serkol » 31.10.2014, 08:46

I also have this problem with a fresh install 2.0

:(

Please help I love this little program and I would buy the template add on if the uploads worked.

Cheers and hope we can work it out for the simpler minded.
Serkol
 
Posts: 11
Joined: 27.10.2014, 23:27

Re: Corrupt files after uploading

Postby Remiguel » 01.11.2014, 01:24

@davidgarcia0001
I send you a private message with instructions. Do you have tried them?

@Serkol
Check your database first. In setting table have a look to be sure you haven't any double password under "filePass".
Remiguel
 
Posts: 96
Joined: 10.06.2014, 09:34
Location: Spain / France

Re: Corrupt files after uploading

Postby Serkol » 01.11.2014, 03:30

Hi Remiguel,

Thank you for the reply, and that is most likely the issue.

However, is there anyway to completely remove file encryption?

So it can be easily view anywhere?

Thanks
Serkol
 
Posts: 11
Joined: 27.10.2014, 23:27

Re: Corrupt files after uploading

Postby Serkol » 01.11.2014, 04:57

Turns out I only had 1 filePass.

Anyway I want to be able to view it outside the actual Collabtive GUI in Windows say...

So one would think that after logging on to your Collabtive GUI, therefore passing the encryption? and downloading a file that was uploaded to a project... You should be able to view it on said trust computer because that's why you have a password in the first place?

Maybe the encryption thing has gone a bit far? But its not such a bad idea... Must be a bitch to implement. :(
Serkol
 
Posts: 11
Joined: 27.10.2014, 23:27

Re: Corrupt files after uploading

Postby Abacus » 01.11.2014, 10:20

Hi,
But it does not function!

Safari, Firefox (Mac OS), Internet Explorer (Win) can not open files (tested with pdf, doc and docx files) after download!

Only chromium (Mac OSX) works up to now successfully!

This is a big problem for a daily useful system! Can everbody help? or is this possible we work without the encryption for next time?
Abacus
 
Posts: 1
Joined: 01.11.2014, 10:10

Re: Corrupt files after uploading

Postby Remiguel » 01.11.2014, 11:58

Good morning Serkol

First at all, backup your files (even encrypted)
Copy the php code below, in a plain text file with php extension (eg. extra.php)
Place this file in the root folder of collabtive (where update.php is located)
Replace on the following line, number 28 by a number of an existing folder (only to run as test)
Code: Select all
$filesList = $conn->query("SELECT * FROM `files` WHERE `project` = 28")->fetchAll();

Replace all pass, with your passwords located in your database
Code: Select all
$list = array('pass8','pass7','pass6','pass5','pass4','pass3','pass2','pass1');

In your case, since you have only one password, leave only your password
Run the script extra.php
Check whether files are decrypted in your folder. If yes, modify the php script, by removing the folder number, to fetch all your files and run extra.php again.
Modify As per the following:
Code: Select all
$filesList = $conn->query("SELECT * FROM `files`")->fetchAll(); // fetch all project of the database


Extra.php
Code: Select all
<?php
require("./init.php");
$path = "./include/phpseclib";
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

$filesList = $conn->query("SELECT * FROM `files` WHERE `project` = 28")->fetchAll(); // line to fetch one project
//$filesList = $conn->query("SELECT * FROM `files`")->fetchAll(); // fetch all project of the database
$myfile = new datei();

foreach($filesList as $file){

   $tmpFile = CL_ROOT . "/" . $file["datei"];
   $list = array('pass8','pass7','pass6','pass5','pass4','pass3','pass2','pass1');
   $test = file_get_contents($tmpFile);
   $flag = false;
   $good = ""; // clear stream at every loop
        // loop to decrypt with the 8 pass
   foreach ($list as $contrasena) {
   $plaintext = $myfile->decryptPFile($test, $contrasena);
      if($plaintext) {
         $test = $plaintext;
         $good = $plaintext;
         $flag = true;
      } else {
         if ($flag == false) {
         $test = file_get_contents($tmpFile);
         } else {
         $test = $good;
         }
      }   
   }
   
   //will leave the file as it is, if no decryption has occurred
   if(!$plaintext){
      if($good){
         file_put_contents($tmpFile,$good);      
         }
   } else {
   file_put_contents($tmpFile,$plaintext);
   }

}

?>


All your files should be unencrypted now.
You have to remove encryption command while uploading new files. Look at the upload function in managefile.php.
If you need support to do this last modification. Please ask ;)
Remiguel
 
Posts: 96
Joined: 10.06.2014, 09:34
Location: Spain / France

Re: Corrupt files after uploading

Postby Serkol » 01.11.2014, 23:39

Sorry I've just realised this is for people who already have a lot of files uploaded.

I have no files uploaded.

So I guess I will just have to look at the managefile.php to disable automatic encryption?

So none of my new files get encrypted.

Correct?

Thank you so much for the help,

It's a great tool!
Serkol
 
Posts: 11
Joined: 27.10.2014, 23:27

Re: Corrupt files after uploading

Postby Remiguel » 02.11.2014, 00:34

Yes you're right this tool decrypt files already uploaded.

In your case you have to edit class.datei.php file (in include folder)
Go to line 361 and insert // at the begining of the line
Code: Select all
//$this->encryptFile($datei_final);

That should do the trick
Remiguel
 
Posts: 96
Joined: 10.06.2014, 09:34
Location: Spain / France

Re: Corrupt files after uploading

Postby Serkol » 02.11.2014, 00:41

Wow thank you so much :):):)

I will test
Serkol
 
Posts: 11
Joined: 27.10.2014, 23:27

Re: Corrupt files after uploading

Postby Philipp » 03.11.2014, 05:06

The method upload() in class.datei.php is only for legacy browser support and rarely used (IE7/8/9 basically).
All other browsers go through uploadAsync() , which doesnt do any encryption at this stage. I will refactor this as soon as i remove IE7/8/9 file support :P

Instead actual encryption is done in managefile.php line 77
Code: Select all
   //encrypt files in their tmp location
       $myfile->encryptFile($file["tmp_name"], $settings["filePass"]);


Remove this line.

Also read this:
viewtopic.php?f=11&t=13188#p24914

Basically with Collabtive 2.0 you need to log in and download a file from the web interface to open it.
You can not open it directly in the upload directory of Collabtive with a filemanager, or download it with FTP.

Safari, Firefox (Mac OS), Internet Explorer (Win) can not open files (tested with pdf, doc and docx files) after download!

Only chromium (Mac OSX) works up to now successfully!


I can't confirm the problems on windows. However there are 2 known bugs:
* You can't use the links from file-uploaded mail notifications - they point to the encrypted files
* Upload in IE7/8/9 is broken (and will be removed next release)
User avatar
Philipp
Site Admin
 
Posts: 1118
Joined: 14.12.2007, 03:06
Location: Saarbrücken, germany

PreviousNext

Return to Problems and Bugs

Who is online

Users browsing this forum: No registered users

cron