Skip to content

Commit

Permalink
オブジェクトストレージのURLに拡張子を含めるように
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Oct 16, 2018
1 parent a103032 commit 704e217
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/services/drive/add-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }`;
Expand Down

0 comments on commit 704e217

Please sign in to comment.