From 20dace5880cb1270c2dc279f229467a03823d955 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Wed, 14 Dec 2016 02:28:41 +0100 Subject: [PATCH] better response for getExtraSymbol --- controller/utilscontroller.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controller/utilscontroller.php b/controller/utilscontroller.php index 32f111d..45b4052 100644 --- a/controller/utilscontroller.php +++ b/controller/utilscontroller.php @@ -23,6 +23,7 @@ use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\IRequest; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Controller; @@ -188,13 +189,12 @@ class UtilsController extends Controller { * @PublicPage */ public function getExtraSymbol() { - $filename = str_replace(array('../', '..\\'), '', $_GET['name']); + $filename = str_replace(array('../', '..\\', '/'), '', $_GET['name']); $filepath = $this->config->getSystemValue('datadirectory').'/gpxedit/symbols/'.$filename; $filecontent = file_get_contents($filepath); - echo $filecontent; - $response = new Response( + $response = new DataDisplayResponse( + $filecontent, \OCP\AppFramework\Http::STATUS_OK, Array('Content-type'=>'image/png') ); - $response->setHeaders(Array('Content-type'=>'image/png')); $csp = new ContentSecurityPolicy(); $csp->addAllowedImageDomain('*') ->addAllowedMediaDomain('*')