Skip to content

Commit 12434a9

Browse files
committed
Fix 404 when deleting indexed cloud
When 2 clouds have the same name the second one has a different url with `cloudByIndex` as additional intermediate. When deleting the cloud it redirected to `..` i.e. `/cloud/cloudByIndex/` which produces a 404. Deleting a cloud now redirects to `/cloud`
1 parent fdf986d commit 12434a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/hudson/slaves/Cloud.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
import org.kohsuke.accmod.Restricted;
5858
import org.kohsuke.accmod.restrictions.DoNotUse;
5959
import org.kohsuke.stapler.DataBoundConstructor;
60-
import org.kohsuke.stapler.HttpRedirect;
6160
import org.kohsuke.stapler.HttpResponse;
61+
import org.kohsuke.stapler.HttpResponses;
6262
import org.kohsuke.stapler.StaplerRequest;
6363
import org.kohsuke.stapler.StaplerRequest2;
6464
import org.kohsuke.stapler.StaplerResponse2;
@@ -313,7 +313,7 @@ public String getIconAltText() {
313313
public HttpResponse doDoDelete() throws IOException {
314314
checkPermission(Jenkins.ADMINISTER);
315315
Jenkins.get().clouds.remove(this);
316-
return new HttpRedirect("..");
316+
return HttpResponses.redirectViaContextPath("cloud");
317317
}
318318

319319
/**

0 commit comments

Comments
 (0)