diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-16 20:59:36 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-16 20:59:36 +0900 |
| commit | 704e217dbbcd30a75667670d99bb1a01eaee2442 (patch) | |
| tree | 5856188122dcad9c3f72d9838da59583cd66e512 | |
| parent | 10.21.1 (diff) | |
| download | sharkey-704e217dbbcd30a75667670d99bb1a01eaee2442.tar.gz sharkey-704e217dbbcd30a75667670d99bb1a01eaee2442.tar.bz2 sharkey-704e217dbbcd30a75667670d99bb1a01eaee2442.zip | |
オブジェクトストレージのURLに拡張子を含めるように
| -rw-r--r-- | src/services/drive/add-file.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index 4f637f16ee..3e689bec6a 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -37,8 +37,10 @@ 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 key = `${config.drive.prefix}/${uuid.v4()}`; - const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}`; + const [ext] = (name.match(/\.([a-zA-Z0-9_-]+)$/) || ['']); + + const key = `${config.drive.prefix}/${uuid.v4()}${ext}`; + const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}.jpg`; 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 }`; |