summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-09-10 21:36:43 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-09-10 21:36:43 +0900
commit5b09209ef9f406ef7f6c3bcac7ec59c303e51fc4 (patch)
treebb362536ffb8077b8bb3f61b01481b686338e405 /src
parentRevert "Fix bug" (diff)
downloadsharkey-5b09209ef9f406ef7f6c3bcac7ec59c303e51fc4.tar.gz
sharkey-5b09209ef9f406ef7f6c3bcac7ec59c303e51fc4.tar.bz2
sharkey-5b09209ef9f406ef7f6c3bcac7ec59c303e51fc4.zip
Fix bug
Diffstat (limited to 'src')
-rw-r--r--src/services/drive/add-file.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts
index d1c7051ab0..828ebcbb94 100644
--- a/src/services/drive/add-file.ts
+++ b/src/services/drive/add-file.ts
@@ -36,8 +36,11 @@ 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()}/${name}`;
- const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}/${name}.thumbnail.jpg`;
+
+ 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 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 }`;
@@ -61,8 +64,8 @@ async function save(path: string, name: string, type: string, hash: string, size
key: key,
thumbnailKey: thumbnailKey
},
- url: `${ baseUrl }/${ key }`,
- thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailKey }` : null
+ url: `${ baseUrl }/${ keyDir }/${ encodeURIComponent(name) }`,
+ thumbnailUrl: thumbnail ? `${ baseUrl }/${ thumbnailKeyDir }/${ encodeURIComponent(name) }.thumbnail.jpg` : null
});
const file = await DriveFile.insert({