Skip to content

Commit e928893

Browse files
committed
Hide port from minio URL for protocol default port
Signed-off-by: Thor77 <thor77@thor77.org>
1 parent 7f0fe69 commit e928893

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/web/imageRouter/minio.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ exports.uploadImage = function (imagePath, callback) {
4040
callback(new Error(err), null)
4141
return
4242
}
43-
callback(null, `${protocol}://${config.minio.endPoint}:${config.minio.port}/${config.s3bucket}/${key}`)
43+
let hidePort = (protocol === 'http' && config.minio.port === 80) || (protocol === 'https' && config.minio.port === 443)
44+
let urlPort = hidePort ? '' : `:${config.minio.port}`
45+
callback(null, `${protocol}://${config.minio.endPoint}${urlPort}/${config.s3bucket}/${key}`)
4446
})
4547
})
4648
}

0 commit comments

Comments
 (0)