mirror of
https://github.com/theonedev/onedev.git
synced 2025-12-08 18:26:30 +00:00
fix: Correct project retrieval in runJob method of McpHelperResource
This commit is contained in:
parent
d0c7a68be9
commit
7eee7de067
@ -2062,18 +2062,16 @@ public class McpHelperResource {
|
||||
@POST
|
||||
public Map<String, Object> runJob(
|
||||
@QueryParam("currentProject") @NotNull String currentProjectPath,
|
||||
@QueryParam("project") String projectPath,
|
||||
@NotNull @Valid Map<String, Serializable> data) {
|
||||
if (SecurityUtils.getAuthUser() == null)
|
||||
throw new UnauthenticatedException();
|
||||
|
||||
var projectInfo = getProjectInfo(projectPath, currentProjectPath);
|
||||
var project = getProject(currentProjectPath);
|
||||
|
||||
var jobName = StringUtils.trimToNull((String)data.get("jobName"));
|
||||
if (jobName == null)
|
||||
throw new NotAcceptableException("Job name is required");
|
||||
|
||||
var project = projectInfo.project;
|
||||
if (!SecurityUtils.canRunJob(project, jobName))
|
||||
throw new UnauthorizedException();
|
||||
|
||||
@ -2130,7 +2128,7 @@ public class McpHelperResource {
|
||||
throw new NotAcceptableException(e.getMessage());
|
||||
}
|
||||
|
||||
var buildMap = getBuildMap(projectInfo.currentProject, build);
|
||||
var buildMap = getBuildMap(project, build);
|
||||
buildMap.put("id", build.getId());
|
||||
return buildMap;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user