Page 3 of 4

Re: Corrupt files after uploading

PostPosted: 31.10.2014, 08:46
by Serkol
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.

Re: Corrupt files after uploading

PostPosted: 01.11.2014, 01:24
by Remiguel
@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".

Re: Corrupt files after uploading

PostPosted: 01.11.2014, 03:30
by Serkol
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

Re: Corrupt files after uploading

PostPosted: 01.11.2014, 04:57
by Serkol
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. :(

Re: Corrupt files after uploading

PostPosted: 01.11.2014, 10:20
by Abacus
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?

Re: Corrupt files after uploading

PostPosted: 01.11.2014, 11:58
by Remiguel
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 ;)

Re: Corrupt files after uploading

PostPosted: 01.11.2014, 23:39
by Serkol
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!

Re: Corrupt files after uploading

PostPosted: 02.11.2014, 00:34
by Remiguel
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

Re: Corrupt files after uploading

PostPosted: 02.11.2014, 00:41
by Serkol
Wow thank you so much :):):)

I will test

Re: Corrupt files after uploading

PostPosted: 03.11.2014, 05:06
by Philipp
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)