diff --git a/src/app/template/controllers/TemplateController.php b/src/app/template/controllers/TemplateController.php index bc73dc60e5afc29214b0c5b5ed4c4d85133aef15..752eb85a95e9262da6dc746d2e8c5569c3d1c694 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 5b162e67b1aa44cd11043b95a07d490066c6b53d..9fa8ccf6e82d28565f21301f72f13e6e45ba5a48 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';