From cfbb6e8092e7579385d0e31dfe44e8dab57f2add Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 16 Oct 2018 20:14:06 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AA=E3=83=96=E3=82=B8=E3=82=A7=E3=82=AF?= =?UTF-8?q?=E3=83=88=E3=82=B9=E3=83=88=E3=83=AC=E3=83=BC=E3=82=B8=E3=81=AE?= =?UTF-8?q?URL=E3=81=AB=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E5=90=8D?= =?UTF-8?q?=E3=82=92=E5=90=AB=E3=82=81=E3=82=8B=E3=81=AE=E3=82=92=E5=BB=83?= =?UTF-8?q?=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/drive/add-file.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index f8c54b2af..4f637f16e 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -37,10 +37,8 @@ async function save(path: string, name: string, type: string, hash: string, size if (config.drive && config.drive.storage == 'minio') { const minio = new Minio.Client(config.drive.config); - const keyDir = `${config.drive.prefix}/${uuid.v4()}`; - const key = `${keyDir}/${name}`; - const thumbnailKeyDir = `${config.drive.prefix}/${uuid.v4()}`; - const thumbnailKey = `${thumbnailKeyDir}/${name}.thumbnail.jpg`; + const key = `${config.drive.prefix}/${uuid.v4()}`; + const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}`; const baseUrl = config.drive.baseUrl || `${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? `:${config.drive.config.port}` : '' }/${ config.drive.bucket }`; @@ -64,8 +62,8 @@ async function save(path: string, name: string, type: string, hash: string, size key: key, thumbnailKey: thumbnailKey }, - url: `${ baseUrl }/${ keyDir }/${ encodeURIComponent(name) }`, - thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailKeyDir }/${ encodeURIComponent(name) }.thumbnail.jpg` : null + url: `${ baseUrl }/${ key }`, + thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailKey }` : null }); const file = await DriveFile.insert({