Skip to content

Commit

Permalink
fix(controller): runtime can not upload when user is not system admin
Browse files Browse the repository at this point in the history
  • Loading branch information
jialeicui committed Jun 27, 2023
1 parent b257518 commit 53a3b11
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public String generateGatewayUrl(Long taskId, String taskIp, int port) {
if (featuresProperties.isJobProxyEnabled()) {
return String.format(TASK_GATEWAY_PATTERN, taskId, port);
} else {
return String.format("http://%s/%d", taskIp, port);
return String.format("http://%s:%d", taskIp, port);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,7 @@ boolean isDataStore(HttpServletRequest request) {
public static String SYSTEM_PROJECT = "0";

private Set<String> projectsOfNoneDataStore(HttpServletRequest request) {
// this filter only works for project parameter in url or parameter
// we assume that no project parameter in post body
// and read project parameter from post body will interfere with the getInputStream() method,
// so we return empty set here if the request is a post request with form data or www-form-urlencoded
var method = request.getMethod();
var contentType = request.getContentType();
if ("POST".equalsIgnoreCase(method)
&& (contentType.contains("form-data") || contentType.contains("www-form-urlencoded"))) {
return Set.of();
}

String projectUrl = request.getParameter("project");
if (!StrUtil.isEmpty(projectUrl)) {
return Set.of(projectUrl);
}
projectUrl = request.getParameter("projectUrl");
if (!StrUtil.isEmpty(projectUrl)) {
return Set.of(projectUrl);
}
projectUrl = HttpUtil.getResourceUrlFromPath(request.getRequestURI(), Resources.PROJECT);
var projectUrl = HttpUtil.getResourceUrlFromPath(request.getRequestURI(), Resources.PROJECT);
if (!StrUtil.isEmpty(projectUrl)) {
return Set.of(URLDecoder.decode(projectUrl, Charset.defaultCharset()));
}
Expand Down

0 comments on commit 53a3b11

Please sign in to comment.