空文字列のobjectStorageEndtpoinをnullと同様に扱う (#10312)

This commit is contained in:
YS 2023-03-13 09:45:21 +09:00 committed by GitHub
parent 7e9d3d9b2f
commit 44213812b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -19,12 +19,14 @@ export class S3Service {
@bindThis
public getS3(meta: Meta) {
const u = meta.objectStorageEndpoint != null
const u = meta.objectStorageEndpoint
? `${meta.objectStorageUseSSL ? 'https://' : 'http://'}${meta.objectStorageEndpoint}`
: `${meta.objectStorageUseSSL ? 'https://' : 'http://'}example.net`;
return new S3({
endpoint: meta.objectStorageEndpoint ?? undefined,
endpoint: meta.objectStorageEndpoint && meta.objectStorageEndpoint.length > 0
? meta.objectStorageEndpoint
: undefined,
accessKeyId: meta.objectStorageAccessKey!,
secretAccessKey: meta.objectStorageSecretKey!,
region: meta.objectStorageRegion ?? undefined,