mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-18 16:48:07 +09:00
オブジェクトストレージのURLにファイル名を含めるのを廃止
This commit is contained in:
parent
0f38215b5e
commit
327c962015
@ -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({
|
||||
|
Loading…
Reference in New Issue
Block a user