DockerActionManager: fix getting the tag from the image

Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
Simon L. 2024-10-31 13:14:12 +01:00
parent 476d80ca54
commit 3ede76af8f

View file

@ -736,16 +736,13 @@ readonly class DockerActionManager {
$output = json_decode($this->guzzleClient->get($url)->getBody()->getContents(), true);
$containerChecksum = $output['Image'];
$tagArray = explode(':', $output['Config']['Image']);
$tag = $tagArray[1];
apcu_add($cacheKey, $tag);
/**
* @psalm-suppress TypeDoesNotContainNull
* @psalm-suppress DocblockTypeContradiction
*/
if ($tag === null) {
if (isset($tagArray[1])) {
$tag = $tagArray[1];
} else {
error_log("No tag was found when getting the current channel. You probably did not follow the documentation correctly. Changing the channel to the default 'latest'.");
$tag = 'latest';
}
apcu_add($cacheKey, $tag);
return $tag;
} catch (\Exception $e) {
error_log('Could not get current channel ' . $e->getMessage());