From 5fc8476bc5caf98e7317b6c1c2cc4c7622d4d69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Dombya?= <135591453+hervedombya@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:17:57 +0200 Subject: [PATCH] ZKUI-381 // Fix objects dowload in 2.1 --- src/js/S3Client.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/js/S3Client.ts b/src/js/S3Client.ts index f16d7eeac..d96c2431a 100644 --- a/src/js/S3Client.ts +++ b/src/js/S3Client.ts @@ -61,13 +61,23 @@ export default class S3Client { ) { const result = this.originalAddAuthorization(credentials, date); - request.endpoint = originalRequest.endpoint; - request.headers = { - ...originalRequest.headers, - ...request.headers, - Host: originalRequest.headers.Host, - }; - request.path = originalRequest.path; + if (!this.isPresigned()) { + request.endpoint = originalRequest.endpoint; + request.headers = { + ...originalRequest.headers, + ...request.headers, + Host: originalRequest.headers.Host, + }; + request.path = originalRequest.path; + } else { + request.endpoint = originalRequest.endpoint; + request.headers = { + ...originalRequest.headers, + ...request.headers, + Host: originalRequest.headers.Host, + }; + request.path = s3Path + request.path; + } return result; };