summaryrefslogtreecommitdiff
path: root/packages/backend/src
diff options
context:
space:
mode:
authorEsurio/1673beta <60435625+1673beta@users.noreply.github.com>2025-02-11 20:45:31 +0900
committerGitHub <noreply@github.com>2025-02-11 11:45:31 +0000
commitebd06becbf58cf06a3dfd77a514ac5ebd6a0aa5e (patch)
treef5fff33dd3ff3ffcbec58cb8d0d80d79e465d5f0 /packages/backend/src
parentfix(frontend-test): Update url-preview.test.ts (diff)
downloadsharkey-ebd06becbf58cf06a3dfd77a514ac5ebd6a0aa5e.tar.gz
sharkey-ebd06becbf58cf06a3dfd77a514ac5ebd6a0aa5e.tar.bz2
sharkey-ebd06becbf58cf06a3dfd77a514ac5ebd6a0aa5e.zip
fix(backend): オブジェクトストレージの設定でPrefixを設定していなかった場合、nullが文字列として展開・ドメインの1つ後ろに'/'が挿入されないように (#15432)
Diffstat (limited to 'packages/backend/src')
-rw-r--r--packages/backend/src/core/DriveService.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts
index c332e5a0a8..1550fe3d3c 100644
--- a/packages/backend/src/core/DriveService.ts
+++ b/packages/backend/src/core/DriveService.ts
@@ -173,7 +173,8 @@ export class DriveService {
?? `${ this.meta.objectStorageUseSSL ? 'https' : 'http' }://${ this.meta.objectStorageEndpoint }${ this.meta.objectStoragePort ? `:${this.meta.objectStoragePort}` : '' }/${ this.meta.objectStorageBucket }`;
// for original
- const key = `${this.meta.objectStoragePrefix}/${randomUUID()}${ext}`;
+ const prefix = this.meta.objectStoragePrefix ? `${this.meta.objectStoragePrefix}/` : '';
+ const key = `${prefix}${randomUUID()}${ext}`;
const url = `${ baseUrl }/${ key }`;
// for alts
@@ -190,7 +191,7 @@ export class DriveService {
];
if (alts.webpublic) {
- webpublicKey = `${this.meta.objectStoragePrefix}/webpublic-${randomUUID()}.${alts.webpublic.ext}`;
+ webpublicKey = `${prefix}webpublic-${randomUUID()}.${alts.webpublic.ext}`;
webpublicUrl = `${ baseUrl }/${ webpublicKey }`;
this.registerLogger.info(`uploading webpublic: ${webpublicKey}`);
@@ -198,7 +199,7 @@ export class DriveService {
}
if (alts.thumbnail) {
- thumbnailKey = `${this.meta.objectStoragePrefix}/thumbnail-${randomUUID()}.${alts.thumbnail.ext}`;
+ thumbnailKey = `${prefix}thumbnail-${randomUUID()}.${alts.thumbnail.ext}`;
thumbnailUrl = `${ baseUrl }/${ thumbnailKey }`;
this.registerLogger.info(`uploading thumbnail: ${thumbnailKey}`);