Skip to content

Commit

Permalink
Respond with 404 if add-on is missing in add-on service (#3989)
Browse files Browse the repository at this point in the history
* Respond with 404 if add-on is missing in add-on service

Signed-off-by: Jan N. Klug <[email protected]>
  • Loading branch information
J-N-K committed Dec 31, 2023
1 parent 8b14d56 commit 2abe4e2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ public Response getById(
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);
Expand Down Expand Up @@ -294,7 +295,7 @@ public Response installAddonByURL(
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(() -> {
Expand Down

0 comments on commit 2abe4e2

Please sign in to comment.