RED-6444: Download with onetime token uses tenant from request parameter
This commit is contained in:
parent
d392c1dae7
commit
3f65a7ff00
@ -262,13 +262,18 @@ public class DownloadController implements DownloadResource {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<FileSystemResource> downloadFileUsingOTT(@PathVariable(OTT) String oneTimeToken,
|
||||
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline) {
|
||||
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline,
|
||||
@RequestParam(value = "tenantId") String tenantId) {
|
||||
|
||||
TenantContext.setTenantId(tenantId);
|
||||
|
||||
log.debug("downloadFileUsingOTT '{}'", oneTimeToken);
|
||||
var token = oneTimeTokenDownloadService.getToken(oneTimeToken);
|
||||
var downloadStatus = getDownloadStatus(token.getStorageId(), token.getUserId());
|
||||
var fileDownloadStream = getFileForDownload(token.getStorageId(), token.getUserId());
|
||||
|
||||
TenantContext.clear();
|
||||
|
||||
return getResponseEntity(inline, fileDownloadStream, downloadStatus.getFilename(), MediaType.parseMediaType("application/zip"));
|
||||
|
||||
}
|
||||
|
||||
@ -84,6 +84,7 @@ public interface DownloadResource {
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Download with this Id is no longer available"), @ApiResponse(responseCode = "400", description = "OTT is not valid")})
|
||||
@GetMapping(value = REST_PATH + OTT_PATH + OTT_PATH_VARIABLE)
|
||||
ResponseEntity<FileSystemResource> downloadFileUsingOTT(@PathVariable(OTT) String oneTimeToken,
|
||||
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline);
|
||||
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline,
|
||||
@RequestParam(value = "tenantId") String tenantId);
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user