From 82b499939f5b7773aa67bb18c166d69bfc1081f5 Mon Sep 17 00:00:00 2001 From: "Timothy J. Aveni" Date: Wed, 3 Jan 2024 15:29:37 -0500 Subject: [PATCH] Apply minio/minio-js#1234 --- src/minio.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/minio.js b/src/minio.js index 9a9cb9a6..e403a40e 100644 --- a/src/minio.js +++ b/src/minio.js @@ -631,10 +631,13 @@ export class Client extends TypedClient { // * `expiry` _number_: expiry in seconds (optional, default 7 days) // * `reqParams` _object_: request parameters (optional) e.g {versionId:"10fa9946-3f64-4137-a58f-888065c0732e"} // * `requestDate` _Date_: A date object, the url will be issued at (optional) - presignedUrl(method, bucketName, objectName, expires, reqParams, requestDate, cb) { + presignedUrl(method, bucketName, objectName, expires, reqParams, requestDate, signedHost, cb) { if (this.anonymous) { throw new errors.AnonymousRequestError('Presigned ' + method + ' url cannot be generated for anonymous requests') } + if (isFunction(signedHost)) { + cb = signedHost + } if (isFunction(requestDate)) { cb = requestDate requestDate = new Date() @@ -670,7 +673,11 @@ export class Client extends TypedClient { // This statement is added to ensure that we send error through // callback on presign failure. var url - var reqOptions = this.getRequestOptions({ method, region, bucketName, objectName, query }) + var headers = {} + if(signedHost) { + headers.host = signedHost + } + var reqOptions = this.getRequestOptions({ method, region, bucketName, objectName, query, headers }) this.checkAndRefreshCreds() try {