From e928893cfe68ecac68448840798ed00a31a856cd Mon Sep 17 00:00:00 2001 From: Thor77 Date: Tue, 11 Dec 2018 22:23:57 +0100 Subject: [PATCH 1/2] Hide port from minio URL for protocol default port Signed-off-by: Thor77 --- lib/web/imageRouter/minio.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/web/imageRouter/minio.js b/lib/web/imageRouter/minio.js index b921c2d2..1085a727 100644 --- a/lib/web/imageRouter/minio.js +++ b/lib/web/imageRouter/minio.js @@ -40,7 +40,9 @@ exports.uploadImage = function (imagePath, callback) { callback(new Error(err), null) return } - callback(null, `${protocol}://${config.minio.endPoint}:${config.minio.port}/${config.s3bucket}/${key}`) + let hidePort = (protocol === 'http' && config.minio.port === 80) || (protocol === 'https' && config.minio.port === 443) + let urlPort = hidePort ? '' : `:${config.minio.port}` + callback(null, `${protocol}://${config.minio.endPoint}${urlPort}/${config.s3bucket}/${key}`) }) }) } From 87ba625d46f55a063cc91bc87bab4eae48dd5744 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Wed, 12 Dec 2018 12:47:07 +0100 Subject: [PATCH 2/2] Remove checks for protocol before removing port Signed-off-by: Thor77 --- lib/web/imageRouter/minio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/imageRouter/minio.js b/lib/web/imageRouter/minio.js index 1085a727..1d993a45 100644 --- a/lib/web/imageRouter/minio.js +++ b/lib/web/imageRouter/minio.js @@ -40,7 +40,7 @@ exports.uploadImage = function (imagePath, callback) { callback(new Error(err), null) return } - let hidePort = (protocol === 'http' && config.minio.port === 80) || (protocol === 'https' && config.minio.port === 443) + let hidePort = [80, 443].includes(config.minio.port) let urlPort = hidePort ? '' : `:${config.minio.port}` callback(null, `${protocol}://${config.minio.endPoint}${urlPort}/${config.s3bucket}/${key}`) })