* 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
This commit is contained in:
Dávid Danyi 2018-09-06 16:37:37 +02:00
parent 9563eae0b1
commit 65098ee587
3 changed files with 9 additions and 4 deletions

View File

@ -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);
}
}
}
}

View File

@ -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(),

5
src/App/Handler/AvatarHandler.php Normal file → Executable file
View File

@ -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');
}