Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,11 @@ public ResponseEntity<InputStream> downloadArtifact(
? logDownload(RequestResponseContextHolder.getHttpServletRequest(), target, module.getId())
: null; // range request - could have too many - so doesn't check action, don't log action status, and don't publish events
result = FileStreamingUtil.writeFileResponse(file, artifact.getFilename(), artifact.getCreatedAt(),
RequestResponseContextHolder.getHttpServletResponse(),
RequestResponseContextHolder.getHttpServletRequest(),
RequestResponseContextHolder.getHttpServletRequest(), RequestResponseContextHolder.getHttpServletResponse(),
(length, shippedSinceLastEvent, total) -> {
if (actionStatus != null) {
eventPublisher.publishEvent(new DownloadProgressEvent(
AccessContext.tenant(), actionStatus.getId(), shippedSinceLastEvent));
eventPublisher.publishEvent(
new DownloadProgressEvent(AccessContext.tenant(), actionStatus.getId(), shippedSinceLastEvent));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ public ResponseEntity<InputStream> downloadArtifact(final Long softwareModuleId,
}

return FileStreamingUtil.writeFileResponse(file, artifact.getFilename(), artifact.getCreatedAt(),
RequestResponseContextHolder.getHttpServletResponse(), request, null);
request, RequestResponseContextHolder.getHttpServletResponse(), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1537,16 +1537,13 @@ private void assertArtifact(final SoftwareModule sm, final byte[] random) throws
.as("wrong metadata of the filename").isEqualTo("origFilename");
}

private void downloadAndVerify(final SoftwareModule sm, final byte[] random, final Artifact artifact)
throws Exception {
private void downloadAndVerify(final SoftwareModule sm, final byte[] random, final Artifact artifact) throws Exception {
final MvcResult result = mvc
.perform(
get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(), artifact.getId()))
.perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(), artifact.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM))
.andExpect(header().string("ETag", artifact.getSha1Hash()))
.andReturn();

assertArrayEquals(result.getResponse().getContentAsByteArray(), random, "Wrong response content");
}

Expand Down
Loading
Loading