Enabled Encryption malforming documents
-
Hello,
I have an issue with this Plugin and Downloading any sort of Document, when encryption is enabled. This malformes the downloaded documents.
I have already reinstalled the plugin, but this did not fix it.
Examples are:
TXT:
Left: redownloaded Version
Right: Original
http://puu.sh/hH8rv/2699e013ca.pngFull Files are linked below.
PDF:
Left: redownloaded Version
Right: Original
http://puu.sh/hH8zr/6ba7938905.pngFull Files:
http://cdn.germangang.com/content/008/test-pdf-original.pdf
http://cdn.germangang.com/content/008/test-pdf-redownloaded.pdf
http://cdn.germangang.com/content/008/test-txt-original.txt
http://cdn.germangang.com/content/008/test-txt-redownloaded.txt
-
Try disabling debug messages. If you have erorrs on your site, and debug messages enabled, they will be written into any document being pushed to client from server.
define(‘WP_DEBUG’, false); is already set.
And file away does not have such an option, or at least did I not find it yet.
Also now it also happens in unencrypted mode.
If stats are enabled, it is still pushing the downloads from server to client, with or without encryption enabled. File Away has no debug writing mode, no.
File Away itself simply pushes files to the client from the server when stats or encryption are enabled.
Yes, thank you, I can confirm this. Disabling stats and encryption did fix this.
But we want to use encryption, since the documents shared are private Documents and we dont want them to be publicly accessable. As a temporary fix, disabling stats and encryption is sufficient, but this is not a long-term Solution.
It is to note, that this Problem only appears since the last update(either 3.9.5 or 3.9.6), and since this is a bug, that can definitely be traced to your implementation, it would be very nice, if you could fix this, or we would have to switch to a different Plugin.
If you need any additional Informations, please come back to me.
I’ll look into it.
There were no changes made to the download class between 3.9.5 and 3.9.6. The only difference between 3.9.6 and earlier 3.9 versions is between 3.9.1, and the difference pertains to how I get the basename of the file, which wouldn’t affect you, since it’s a setting, and certainly wouldn’t affect the contents of the file itself. Here’s the difference:
3.9.1:
$name = basename($file);3.9.6:
$name = fileaway_utility::basename($file);And here’s that function:
public static function basename($path_file) { return fileaway_definitions::$pathinfo ? self::pathinfo($path_file, PATHINFO_BASENAME) : basename($path_file); }I’m still looking into it.
I’m able to duplicate your issue with
test-txt-original.txtbut I am able to downloadtest-pdf-original.pdfjust fine every time with no issues, in 3.9.5 AND in 3.9.6.I am still trying to figure out why the lines are being removed from test-txt-original.txt because I have another (private) plugin that uses the exact same download function as File Away, to the letter, and my private plugin downloads the test-txt-original.txt just fine, while with File Away’s it downloads with lines removed. The files are identical, and the functions are identical. So it’s a conundrum.
But, by the way, I’m getting the line-removal with test-txt-original.txt in versions going all the way back to File Away 3.9. (I don’t have an earlier version handy at the moment, but I’ll try to find one.)
It occurs in 3.8.4 also, with the text file.
Any update?
Just trested it with a PDF and Problem still exists.
Like I said, I tested it with the same pdf file you linked above, and it downloaded fine for me, so I can’t troubleshoot what I can’t duplicate, on that score. I do get the issue with the .txt file, but I haven’t found a solution for that yet. It’s inexplicable to me as I use the exact same download code in another plugin of mine, and the issue with the .txt file doesn’t occur there. Can’t nail it down.
Can you give me the sourcecode of the Plugins and different Versions, so I can do some research on my own?
The other plugin is proprietary, but as I said, the function is precisely identical, to the letter.
Here’s the function for version 3.0:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"$name\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); flush(); ob_clean(); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }Here’s the function for version 3.1:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"$name\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); flush(); ob_clean(); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }Here’s the function for version 3.5:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); $mime = $this->mimes(strtolower(substr(strrchr($file, '.'), 1))); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: ".$mime); //header("Content-Type: application/octet-stream;"); //header("Content-Type: application/force-download"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"$name\""); //header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); ob_end_flush(); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }Here’s the function for version 3.6:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); $mime = $this->mimes(strtolower(substr(strrchr($file, '.'), 1))); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: ".$mime); //header("Content-Type: application/octet-stream;"); //header("Content-Type: application/force-download"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"$name\""); //header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); ob_end_flush(); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }Here’s the function for 3.6.1:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); $mime = $this->mimes(strtolower(substr(strrchr($file, '.'), 1))); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: ".$mime); //header("Content-Type: application/octet-stream;"); //header("Content-Type: application/force-download"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"$name\""); //header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); ob_end_flush(); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }Here’s the function for 3.6.2:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); $mime = $this->mimes(strtolower(substr(strrchr($file, '.'), 1))); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: ".$mime); //header("Content-Type: application/octet-stream;"); //header("Content-Type: application/force-download"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"$name\""); //header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); ob_end_flush(); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }Here’s the function for 3.7:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); $mime = $this->mimes(strtolower(substr(strrchr($file, '.'), 1))); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: ".$mime); //header("Content-Type: application/octet-stream;"); //header("Content-Type: application/force-download"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"$name\""); //header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); ob_end_flush(); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }Here’s the function for 3.8:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); $mime = $this->mimes(strtolower(substr(strrchr($file, '.'), 1))); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: ".$mime); //header("Content-Type: application/octet-stream;"); //header("Content-Type: application/force-download"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"$name\""); //header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); ob_end_flush(); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }Here’s the function for 3.8.1:
public function download() { $file = $this->decrypt($_GET['fileaway']); $file = fileaway_utility::urlesc($file, true); if(!is_file($file)) die('Sorry. That file could not be found.'); if(!wp_verify_nonce($_GET['nonce'], 'fileaway-download')) die('Sorry. The download could not be verified.'); $name = basename($file); $size = filesize($file); $mime = $this->mimes(strtolower(substr(strrchr($file, '.'), 1))); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: ".$mime); //header("Content-Type: application/octet-stream;"); //header("Content-Type: application/force-download"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"$name\""); //header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $size); ob_end_flush(); set_time_limit(0); $file = @fopen($file, 'rb'); if($file) { while(!feof($file)) { print(fread($file, 1024*8)); if(connection_status()!=0) { @fclose($file); die(); } } @fclose($file); } die(); }
The topic ‘Enabled Encryption malforming documents’ is closed to new replies.