Skip to content

Commit 9937ac2

Browse files
committed
Fix app not found
1 parent 8516089 commit 9937ac2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/java/eu/openanalytics/shinyproxy/controllers/AppController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,16 @@ private ModelAndView app(ModelMap map, HttpServletRequest request, String appNam
121121
Proxy proxy = findUserProxy(appName, appInstance);
122122

123123
ProxySpec spec = proxyService.getUserSpec(appName);
124-
Optional<RedirectView> redirect = createRedirectIfRequired(request, subPath, spec);
125-
if (redirect.isPresent()) {
126-
return new ModelAndView(redirect.get());
127-
}
128-
129124
if (proxy == null && spec == null) {
130125
request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE, HttpStatus.FORBIDDEN.value());
131126
return new ModelAndView("forward:/error");
132127
}
133128

129+
Optional<RedirectView> redirect = createRedirectIfRequired(request, subPath, spec);
130+
if (redirect.isPresent()) {
131+
return new ModelAndView(redirect.get());
132+
}
133+
134134
// if the proxy exists, the proxy object is non-null and the spec might be null (if the spec no longer exists or the user no longer has access to the spec)
135135
// if the proxy does not exists, the proxy object is null and the spec is non-null
136136

src/main/java/eu/openanalytics/shinyproxy/controllers/AppDirectController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private Proxy getOrStart(AppRequestInfo appRequestInfo, HttpServletRequest reque
8888
ProxySpec spec = proxyService.getUserSpec(appRequestInfo.getAppName());
8989

9090
if (spec == null) {
91-
response.setStatus(HttpStatus.FORBIDDEN.value());
91+
request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE, HttpStatus.FORBIDDEN.value());
9292
request.getRequestDispatcher("/error").forward(request, response);
9393
return null;
9494
}

0 commit comments

Comments
 (0)