From 3aeaf6acf9ccaefedabe81e23a7a87e561d8c589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Fri, 13 Sep 2024 20:14:57 +0200 Subject: [PATCH] fix bug when api version would be set to 0 if there is no `m1k1o.neko_rooms.api_version` label and `org.opencontainers.image.` contains different URL. --- internal/room/manager.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/room/manager.go b/internal/room/manager.go index 03d98f2..cac675c 100644 --- a/internal/room/manager.go +++ b/internal/room/manager.go @@ -270,16 +270,17 @@ func (manager *RoomManagerCtx) Create(ctx context.Context, settings types.RoomSe // based on opencontainers image url label if val, ok := inspect.Config.Labels["org.opencontainers.image.url"]; ok { + // TODO: this should be removed in future, but since we have a lot of legacy images, we need to support it switch val { case "https://github.com/m1k1o/neko": settings.ApiVersion = 2 case "https://github.com/demodesk/neko": settings.ApiVersion = 3 } - } else + } - // unable to detect api version - { + // still unable to detect api version + if settings.ApiVersion == 0 { // TODO: this should be removed in future, but since we have a lot of v2 images, we need to support it log.Warn().Str("image", settings.NekoImage).Msg("unable to detect api version, fallback to v2") settings.ApiVersion = 2