From 1624d72dff3d58c76ba83631a9efbf1c92ea67e8 Mon Sep 17 00:00:00 2001 From: "Jan N. Klug" Date: Sun, 18 Jun 2023 17:58:26 +0200 Subject: [PATCH] Fix missing query prefix in JarFileAddonService See title. This brings the query id in-line with the other add-on services. Also adds correct content type. Signed-off-by: Jan N. Klug --- .../openhab/core/addon/internal/JarFileAddonService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/JarFileAddonService.java b/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/JarFileAddonService.java index 2b7819900b6..8b8fe68bcbe 100644 --- a/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/JarFileAddonService.java +++ b/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/JarFileAddonService.java @@ -53,6 +53,7 @@ public class JarFileAddonService extends BundleTracker implements AddonService { public static final String SERVICE_ID = "jar"; public static final String SERVICE_NAME = "JAR-File add-on service"; + private static final String ADDONS_CONTENT_TYPE = "application/vnd.openhab.bundle"; private static final Map ADDON_TYPE_MAP = Map.of( // "automation", new AddonType("automation", "Automation"), // @@ -155,7 +156,7 @@ private Addon toAddon(Bundle bundle, AddonInfo addonInfo) { .withVersion(bundle.getVersion().toString()).withLabel(addonInfo.getName()) .withConfigDescriptionURI(addonInfo.getConfigDescriptionURI()) .withDescription(Objects.requireNonNullElse(addonInfo.getDescription(), bundle.getSymbolicName())) - .build(); + .withContentType(ADDONS_CONTENT_TYPE).build(); } @Override @@ -168,7 +169,8 @@ public List getAddons(@Nullable Locale locale) { @Override public @Nullable Addon getAddon(String id, @Nullable Locale locale) { - return addons.get(id); + String queryId = id.startsWith(ADDON_ID_PREFIX) ? id : ADDON_ID_PREFIX + id; + return addons.get(queryId); } @Override