From 5e651343a74f59737f062d80a0e28178c49314ec Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Thu, 9 Apr 2020 17:53:15 +0100
Subject: [PATCH] FIX #13441 TIME 0:05 Fix TU Template

---
 src/app/template/controllers/TemplateController.php    | 2 +-
 test/unitTests/app/template/TemplateControllerTest.php | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/app/template/controllers/TemplateController.php b/src/app/template/controllers/TemplateController.php
index bc73dc60e5a..752eb85a95e 100755
--- a/src/app/template/controllers/TemplateController.php
+++ b/src/app/template/controllers/TemplateController.php
@@ -217,7 +217,7 @@ class TemplateController
             $finfo    = new \finfo(FILEINFO_MIME_TYPE);
             $mimeType = $finfo->buffer($fileContent);
             if (!in_array($mimeType, self::AUTHORIZED_MIMETYPES)) {
-                return $response->withStatus(400)->withJson(['errors' => _WRONG_FILE_TYPE]);
+                return $response->withStatus(400)->withJson(['errors' => _WRONG_FILE_TYPE . ' : '.$mimeType]);
             }
 
             $storeResult = DocserverController::storeResourceOnDocServer([
diff --git a/test/unitTests/app/template/TemplateControllerTest.php b/test/unitTests/app/template/TemplateControllerTest.php
index 5b162e67b1a..9fa8ccf6e82 100755
--- a/test/unitTests/app/template/TemplateControllerTest.php
+++ b/test/unitTests/app/template/TemplateControllerTest.php
@@ -165,7 +165,7 @@ class TemplateControllerTest extends TestCase
         $response     = $templates->create($fullRequest, new \Slim\Http\Response());
         $this->assertSame(400, $response->getStatusCode());
         $responseBody = json_decode((string)$response->getBody(), true);
-        $this->assertSame(_WRONG_FILE_TYPE, $responseBody['errors']);
+        $this->assertSame(_WRONG_FILE_TYPE . ' : text/plain', $responseBody['errors']);
 
         $request        = \Slim\Http\Request::createFromEnvironment($environment);
 
@@ -423,7 +423,7 @@ class TemplateControllerTest extends TestCase
         $response     = $templates->update($fullRequest, new \Slim\Http\Response(), ['id' => self::$id2]);
         $this->assertSame(400, $response->getStatusCode());
         $responseBody = json_decode((string)$response->getBody(), true);
-        $this->assertSame(_WRONG_FILE_TYPE, $responseBody['errors']);
+        $this->assertSame(_WRONG_FILE_TYPE . ' : text/plain', $responseBody['errors']);
 
         // Fail
         $GLOBALS['login'] = 'bbain';
-- 
GitLab