From 65098ee587c552a8ed290350338c284fb6e518c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Danyi?= Date: Thu, 6 Sep 2018 16:37:37 +0200 Subject: [PATCH] * avatar content-type fix * team default empty values are empty array * page caches only updated if there is actually a filter id set for the team --- src/App/Command/UpdatePageCachesCommand.php | 4 +++- src/App/Entity/Team.php | 4 ++-- src/App/Handler/AvatarHandler.php | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/App/Handler/AvatarHandler.php diff --git a/src/App/Command/UpdatePageCachesCommand.php b/src/App/Command/UpdatePageCachesCommand.php index 3853c4d..132cf77 100755 --- a/src/App/Command/UpdatePageCachesCommand.php +++ b/src/App/Command/UpdatePageCachesCommand.php @@ -36,7 +36,9 @@ class UpdatePageCachesCommand extends Command $teams = $this->teamService->listTeams(); foreach ($teams as $team) { set_time_limit(30); - $this->jiraCollectorService->getKanbanBoard($team->getId(),true); + if (0 < ($teamId = $team->getId())) { + $this->jiraCollectorService->getKanbanBoard($teamId,true); + } } } } diff --git a/src/App/Entity/Team.php b/src/App/Entity/Team.php index 20ffa37..40e76fc 100755 --- a/src/App/Entity/Team.php +++ b/src/App/Entity/Team.php @@ -377,8 +377,8 @@ class Team implements JsonSerializable return [ 'id' => $this->getId(), 'name' => $this->getName(), - 'members' => $this->getMembers(), - 'labels' => $this->getLabels(), + 'members' => $this->getMembers() ?? [], + 'labels' => $this->getLabels() ?? [], 'filterId' => $this->getFilterId(), 'backlogColumn' => $this->getBacklogColumn() ?? new KanbanColumn(), 'inprogressColumn' => $this->getInprogressColumn() ?? new KanbanColumn(), diff --git a/src/App/Handler/AvatarHandler.php b/src/App/Handler/AvatarHandler.php old mode 100644 new mode 100755 index ef38b35..ac8fab9 --- a/src/App/Handler/AvatarHandler.php +++ b/src/App/Handler/AvatarHandler.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace App\Handler; use App\Service\AvatarService; +use finfo; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; @@ -36,8 +37,10 @@ class AvatarHandler implements RequestHandlerInterface } catch (\UnexpectedValueException $e) { return new TextResponse("Avatar not found", 404); } + $finfo = new finfo(FILEINFO_MIME_TYPE); + $contentType = $finfo->buffer($avatarImageData); return (new TextResponse($avatarImageData, 200, [ - 'content-type' => 'image/png', + 'content-type' => $contentType, ]))->withHeader('Expires', '0') ->withHeader('Cache-Control', 'must-revalidate'); }