空文字列の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

View file

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