Merge pull request #5503 from nextcloud/enh/noid/fix-getting-tag

DockerActionManager: fix getting the tag from the image
This commit is contained in:
Simon L. 2024-11-06 12:59:54 +01:00 committed by GitHub
commit bb3236d3e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -736,16 +736,13 @@ readonly class DockerActionManager {
$output = json_decode($this->guzzleClient->get($url)->getBody()->getContents(), true); $output = json_decode($this->guzzleClient->get($url)->getBody()->getContents(), true);
$containerChecksum = $output['Image']; $containerChecksum = $output['Image'];
$tagArray = explode(':', $output['Config']['Image']); $tagArray = explode(':', $output['Config']['Image']);
if (count($tagArray) === 2) {
$tag = $tagArray[1]; $tag = $tagArray[1];
apcu_add($cacheKey, $tag); } else {
/**
* @psalm-suppress TypeDoesNotContainNull
* @psalm-suppress DocblockTypeContradiction
*/
if ($tag === null) {
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'."); 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'; $tag = 'latest';
} }
apcu_add($cacheKey, $tag);
return $tag; return $tag;
} catch (\Exception $e) { } catch (\Exception $e) {
error_log('Could not get current channel ' . $e->getMessage()); error_log('Could not get current channel ' . $e->getMessage());