Skip to content

Commit

Permalink
BXC-4313 fix datastream controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharon Luong committed Jan 12, 2024
1 parent cbbd338 commit 4cd470c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,8 @@ public void streamData(PID pid, String dsName, AccessGroupSet principals, boolea
throw new IllegalArgumentException("Cannot stream external datastream " + datastream);
}

accessControlService.assertHasAccess("Insufficient permissions to access " + datastream + " for object " + pid,
pid, principals, getPermissionForDatastream(datastream));

LOG.debug("Streaming datastream {} from object {}", datastream, pid);



BinaryObject binObj;
if (ORIGINAL_FILE.getId().equals(datastream)) {
FileObject fileObj = repositoryObjectLoader.getFileObject(pid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void getDatastream(@PathVariable("pid") String pidString,
@RequestParam(value = "dl", defaultValue = "false") boolean download,
HttpServletRequest request,
HttpServletResponse response) {
getDatastream(pidString, null, download, request, response);
getDatastream(pidString, ORIGINAL_FILE.getId(), download, request, response);
}

@RequestMapping("/file/{pid}/{datastream}")
Expand All @@ -97,7 +97,7 @@ public void getDatastream(@PathVariable("pid") String pidString,
accessControlService.assertHasAccess("Insufficient permissions to access " + datastream + " for object " + pid,
pid, principals, getPermissionForDatastream(datastream));
fedoraContentService.streamData(pid, datastream, principals, download, response);
if (datastream == null || DatastreamType.ORIGINAL_FILE.getId().equals(datastream)) {
if (DatastreamType.ORIGINAL_FILE.getId().equals(datastream)) {
recordDownloadEvent(pid, datastream, principals, request);
}
}
Expand Down

0 comments on commit 4cd470c

Please sign in to comment.