Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing query prefix in JarFileAddonService #3664

Merged
merged 1 commit into from
Jun 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
public class JarFileAddonService extends BundleTracker<Bundle> 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<String, AddonType> ADDON_TYPE_MAP = Map.of( //
"automation", new AddonType("automation", "Automation"), //
Expand Down Expand Up @@ -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
Expand All @@ -168,7 +169,8 @@ public List<Addon> 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
Expand Down