Skip to content

Commit

Permalink
fix some problems in material download
Browse files Browse the repository at this point in the history
  • Loading branch information
gelxiogong committed Mar 7, 2024
1 parent 03ffd36 commit 080ad0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public class ProjectManagerRestfulApi {

private static final String NO_OPERATION_PERMISSION_MESSAGE = "the current user has no operation permission";

private static final String TYPE_PROJECT = "project";

private static final String TYPE_JOB = "job";

@RequestMapping(path = "/files/upload", method = RequestMethod.POST)
public Message upload(HttpServletRequest req,
@RequestParam(name = "version",required = false) String version,
Expand Down Expand Up @@ -217,8 +221,10 @@ public Message download( HttpServletRequest req, HttpServletResponse response,
if (StringUtils.isBlank(projectName)) {
if (StringUtils.isBlank(materialType)) {
return Message.error("projectName and materialType is null");
} else if (materialType.equals("job")) {
} else if (materialType.equals(TYPE_JOB)) {
file = streamJobService.getJobFileById(id);
} else if (materialType.equals(TYPE_PROJECT)){
file = projectManagerService.getFile(id, projectName);
}
} else {
if (!projectPrivilegeService.hasEditPrivilege(req, projectName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public boolean delete(String fileName, String projectName, String username) {

@Override
public ProjectFiles getFile(Long id, String projectName) {
return StringUtils.isBlank(projectName) ? projectManagerMapper.getJobFile(id) : projectManagerMapper.getProjectFile(id);
return projectManagerMapper.getProjectFile(id);
}

@Override
Expand Down

0 comments on commit 080ad0d

Please sign in to comment.