]> source.dussan.org Git - nextcloud-server.git/commitdiff
URLEncode filenames to be compatible with special characters
authorLukas Reschke <lukas@owncloud.com>
Mon, 20 Oct 2014 18:00:34 +0000 (20:00 +0200)
committerLukas Reschke <lukas@owncloud.com>
Mon, 20 Oct 2014 18:00:34 +0000 (20:00 +0200)
apps/files/controller/apicontroller.php

index 01f9086c27d636b4e509ee143986158eb1075ffd..89d24a5c47f02c5cf92725ef89e1d114e3dd0c79 100644 (file)
@@ -32,7 +32,7 @@ class ApiController extends Controller {
         *
         * @param int $x
         * @param int $y
-        * @param string $file
+        * @param string $file URL-encoded filename
         * @return JSONResponse|DownloadResponse
         */
        public function getThumbnail($x, $y, $file) {
@@ -41,9 +41,9 @@ class ApiController extends Controller {
                }
 
                try {
-                       $preview = new Preview('', 'files', $file, $x, $y, true);
+                       $preview = new Preview('', 'files', urldecode($file), $x, $y, true);
                        echo($preview->showPreview('image/png'));
-                       return new DownloadResponse($file.'.png', 'image/png');
+                       return new DownloadResponse(urldecode($file).'.png', 'image/png');
                } catch (\Exception $e) {
                        return new JSONResponse('File not found.', Http::STATUS_NOT_FOUND);
                }