Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author thomstark

    (@thomstark)

    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.

    Thread Starter Medowar

    (@medowar)

    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.

    Plugin Author thomstark

    (@thomstark)

    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.

    Thread Starter Medowar

    (@medowar)

    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.

    Plugin Author thomstark

    (@thomstark)

    I’ll look into it.

    Plugin Author thomstark

    (@thomstark)

    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);
    }
    Plugin Author thomstark

    (@thomstark)

    I’m still looking into it.

    Plugin Author thomstark

    (@thomstark)

    I’m able to duplicate your issue with test-txt-original.txt but I am able to download test-pdf-original.pdf just 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.)

    Plugin Author thomstark

    (@thomstark)

    It occurs in 3.8.4 also, with the text file.

    Thread Starter Medowar

    (@medowar)

    Any update?

    Just trested it with a PDF and Problem still exists.

    Plugin Author thomstark

    (@thomstark)

    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.

    Thread Starter Medowar

    (@medowar)

    Can you give me the sourcecode of the Plugins and different Versions, so I can do some research on my own?

    Plugin Author thomstark

    (@thomstark)

    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();
    		}
Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Enabled Encryption malforming documents’ is closed to new replies.