From 7e8c5c0c3c97faa01c6e559480a77709935c60f9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 27 Jul 2018 03:21:50 +0900 Subject: [PATCH] Improve readability --- src/services/drive/add-file.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index d2e7dbd862..3cab924b4a 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -25,9 +25,14 @@ async function save(readable: stream.Readable, name: string, type: string, hash: const minio = new Minio.Client(config.drive.config); const id = uuid.v4(); const obj = `${config.drive.prefix}/${id}`; + const baseUrl = config.drive.baseUrl || `${ config.drive.config.secure ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? ':' + config.drive.config.port : '' }/${ config.drive.bucket }`; - await minio.putObject(config.drive.bucket, obj, readable, size, { 'Content-Type': type, 'Cache-Control': 'max-age=31536000, immutable' }); + + await minio.putObject(config.drive.bucket, obj, readable, size, { + 'Content-Type': type, + 'Cache-Control': 'max-age=31536000, immutable' + }); Object.assign(metadata, { withoutChunks: true,