diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/RestApiServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/RestApiServlet.java index be8ae328b2..a4217cf02e 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/RestApiServlet.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/RestApiServlet.java @@ -102,10 +102,13 @@ public abstract class RestApiServlet extends HttpServlet { CapabilityControl ctl = user.getCapabilities(); if (!ctl.canPerform(rc.value()) && !ctl.canAdministrateServer()) { String msg = String.format( - "fatal: %s does not have \"%s\" capability.", - Objects.firstNonNull(user.getUserName(), - ((IdentifiedUser)user).getNameEmail()), - rc.value()); + "fatal: %s does not have \"%s\" capability.", + Objects.firstNonNull( + user.getUserName(), + user instanceof IdentifiedUser + ? ((IdentifiedUser) user).getNameEmail() + : user.toString()), + rc.value()); throw new RequireCapabilityException(msg); } } diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginModule.java index bb47b8b8e5..2bcaa30310 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginModule.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginModule.java @@ -28,6 +28,7 @@ public class HttpPluginModule extends ServletModule { protected void configureServlets() { bind(HttpPluginServlet.class); serve("/plugins/*").with(HttpPluginServlet.class); + serveRegex("^/(?:a/)?plugins/(.*)?$").with(HttpPluginServlet.class); bind(StartPluginListener.class) .annotatedWith(UniqueAnnotations.create())