From c5742520e132dc072bd8e5f69e5568d5c16c3f1e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 11 Jan 2014 11:51:28 +0100 Subject: [PATCH 1/3] don't urldecode get var, php does this automatically --- apps/files_sharing/ajax/publicpreview.php | 2 +- apps/files_trashbin/ajax/preview.php | 2 +- core/ajax/preview.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/files_sharing/ajax/publicpreview.php b/apps/files_sharing/ajax/publicpreview.php index a52f522afa..d12d212a2e 100644 --- a/apps/files_sharing/ajax/publicpreview.php +++ b/apps/files_sharing/ajax/publicpreview.php @@ -11,7 +11,7 @@ if(!\OC_App::isEnabled('files_sharing')){ \OC_User::setIncognitoMode(true); -$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; +$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : ''; $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36'; $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; diff --git a/apps/files_trashbin/ajax/preview.php b/apps/files_trashbin/ajax/preview.php index ce432f4d14..d003a9a079 100644 --- a/apps/files_trashbin/ajax/preview.php +++ b/apps/files_trashbin/ajax/preview.php @@ -11,7 +11,7 @@ if(!\OC_App::isEnabled('files_trashbin')){ exit; } -$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; +$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : ''; $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44'; $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44'; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; diff --git a/core/ajax/preview.php b/core/ajax/preview.php index af0f0493f4..d85dff7632 100644 --- a/core/ajax/preview.php +++ b/core/ajax/preview.php @@ -7,7 +7,7 @@ */ \OC_Util::checkLoggedIn(); -$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; +$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : ''; $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36'; $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; @@ -26,6 +26,7 @@ if($maxX === 0 || $maxY === 0) { exit; } + try{ $preview = new \OC\Preview(\OC_User::getUser(), 'files'); $preview->setFile($file); From f7c291e2768b83176aad6dacbf0139949c2208fd Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 11 Jan 2014 11:53:56 +0100 Subject: [PATCH 2/3] remove empty line --- core/ajax/preview.php | 1 - 1 file changed, 1 deletion(-) diff --git a/core/ajax/preview.php b/core/ajax/preview.php index d85dff7632..a1267d6f5c 100644 --- a/core/ajax/preview.php +++ b/core/ajax/preview.php @@ -26,7 +26,6 @@ if($maxX === 0 || $maxY === 0) { exit; } - try{ $preview = new \OC\Preview(\OC_User::getUser(), 'files'); $preview->setFile($file); From d49c7ad4fb1745600f33f0acc67fa39faca3e3e4 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 30 Jan 2014 16:31:47 +0100 Subject: [PATCH 3/3] Fixed double file encoding for previews --- apps/files_sharing/templates/public.php | 2 +- apps/files_trashbin/lib/trashbin.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 3ddaf4446d..3eb84ce167 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -35,7 +35,7 @@
- +
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 7544980e07..9b7d578c99 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -996,6 +996,6 @@ class Trashbin { } public static function preview_icon($path) { - return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path) )); + return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => $path )); } }