From 14ac4fab054c332fe3a0e110bec6cb118bf83186 Mon Sep 17 00:00:00 2001
From: Florin Peter <github@florin-peter.de>
Date: Tue, 4 Jun 2013 00:41:47 +0200
Subject: [PATCH] better handling for http post

---
 apps/files_encryption/files/error.php | 4 ++++
 apps/files_encryption/lib/helper.php  | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/apps/files_encryption/files/error.php b/apps/files_encryption/files/error.php
index 3118299b51..37e94e5658 100644
--- a/apps/files_encryption/files/error.php
+++ b/apps/files_encryption/files/error.php
@@ -4,6 +4,10 @@ if (!isset($_)) { //also provide standalone error page
 
 	$l = OC_L10N::get('files_encryption');
 
+	if(isset($_GET['p']) && $_GET['p'] === '1') {
+		header('HTTP/1.0 404 ' . $l->t('Your private key is not valid! Maybe the your password was changed from outside.'));
+	}
+
 	// check if ajax request
 	if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
 		\OCP\JSON::error(array('data' => array('message' => $l->t('Your private key is not valid! Maybe the your password was changed from outside.'))));
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index daa95f3f89..923cc2ce9d 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -200,7 +200,11 @@ class Helper {
 	 */
 	public static function redirectToErrorPage() {
 		$location = \OC_Helper::linkToAbsolute('apps/files_encryption/files', 'error.php');
-		header('Location: ' . $location);
+		$post = 0;
+		if(count($_POST) > 0) {
+			$post = 1;
+		}
+		header('Location: ' . $location . '?p=' . $post);
 		exit();
 	}
 }
\ No newline at end of file
-- 
GitLab