From cf449d42e87b21dff0de35c394031c5fa28b56aa Mon Sep 17 00:00:00 2001
From: Georg Ehrke <developer@georgehrke.com>
Date: Wed, 10 Jul 2013 11:25:28 +0200
Subject: [PATCH] properly encode path

---
 apps/files/js/files.js            | 2 +-
 apps/files_trashbin/lib/trash.php | 2 +-
 lib/helper.php                    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 224167b99c..06d193bf8f 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -960,7 +960,7 @@ function getMimeIcon(mime, ready){
 getMimeIcon.cache={};
 
 function getPreviewIcon(path, ready){
-	ready(OC.Router.generate('core_ajax_preview', {file:path, x:44, y:44}));
+	ready(OC.Router.generate('core_ajax_preview', {file: encodeURIComponent(path), x:44, y:44}));
 }
 
 function getUniqueName(name){
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index e82a597c61..fb99fca5b3 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -852,6 +852,6 @@ class Trashbin {
 	}
 
 	public static function preview_icon($path) {
-		return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 44, 'y' => 44, 'file' => $path));
+		return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path) ));
 	}
 }
diff --git a/lib/helper.php b/lib/helper.php
index 0a8962a531..326f2567f9 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -231,7 +231,7 @@ class OC_Helper {
 	 * Returns the path to the preview of the file.
 	 */
 	public static function previewIcon($path) {
-		return self::linkToRoute( 'core_ajax_preview', array('x' => 44, 'y' => 44, 'file' => $path));
+		return self::linkToRoute( 'core_ajax_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path) ));
 	}
 
 	/**
-- 
GitLab