mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Respond with 404 if add-on is missing in add-on service (#3989)
* Respond with 404 if add-on is missing in add-on service Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
+3
-2
@@ -253,9 +253,10 @@ public class AddonResource implements RESTResource {
|
||||
public Response installAddon(final @PathParam("addonId") @Parameter(description = "addon ID") String addonId,
|
||||
@QueryParam("serviceId") @Parameter(description = "service ID") @Nullable String serviceId) {
|
||||
AddonService addonService = (serviceId != null) ? getServiceById(serviceId) : getDefaultService();
|
||||
if (addonService == null) {
|
||||
if (addonService == null || addonService.getAddon(addonId, null) == null) {
|
||||
return Response.status(HttpStatus.NOT_FOUND_404).build();
|
||||
}
|
||||
|
||||
ThreadPoolManager.getPool(THREAD_POOL_NAME).submit(() -> {
|
||||
try {
|
||||
addonService.install(addonId);
|
||||
@@ -294,7 +295,7 @@ public class AddonResource implements RESTResource {
|
||||
public Response uninstallAddon(final @PathParam("addonId") @Parameter(description = "addon ID") String addonId,
|
||||
@QueryParam("serviceId") @Parameter(description = "service ID") @Nullable String serviceId) {
|
||||
AddonService addonService = (serviceId != null) ? getServiceById(serviceId) : getDefaultService();
|
||||
if (addonService == null) {
|
||||
if (addonService == null || addonService.getAddon(addonId, null) == null) {
|
||||
return Response.status(HttpStatus.NOT_FOUND_404).build();
|
||||
}
|
||||
ThreadPoolManager.getPool(THREAD_POOL_NAME).submit(() -> {
|
||||
|
||||
Reference in New Issue
Block a user