RED-7140: make tenantId available in CompletableFeature.supplyAsync

This commit is contained in:
Ali Oezyetimoglu 2023-07-25 09:37:37 +02:00
parent 6e274fccf0
commit 14a46dc237

View File

@ -200,8 +200,11 @@ public class DownloadController implements DownloadResource {
public CompletableFuture<ResponseEntity<InputStreamResource>> downloadFile(@RequestParam(STORAGE_ID) String storageId,
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline) {
var userId = KeycloakSecurity.getUserId();
var tenantId = TenantContext.getTenantId();
return CompletableFuture.supplyAsync(() -> {
TenantContext.setTenantId(tenantId);
var downloadStatus = getDownloadStatus(storageId, userId);
var fileDownloadStream = getFileForDownload(storageId, userId);