From 714807cdc704dffca2041b1cfd2ac654e17ee047 Mon Sep 17 00:00:00 2001 From: fyears Date: Sun, 14 Nov 2021 21:12:31 +0800 Subject: [PATCH] fix endpoint --- src/s3.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/s3.ts b/src/s3.ts index 14151be..17de48e 100644 --- a/src/s3.ts +++ b/src/s3.ts @@ -45,9 +45,13 @@ export const DEFAULT_S3_CONFIG = { export type S3ObjectType = _Object; export const getS3Client = (s3Config: S3Config) => { + let endpoint = s3Config.s3Endpoint; + if (!(endpoint.startsWith("http://") || endpoint.startsWith("https://"))) { + endpoint = `https://${endpoint}`; + } const s3Client = new S3Client({ region: s3Config.s3Region, - endpoint: s3Config.s3Endpoint, + endpoint: endpoint, credentials: { accessKeyId: s3Config.s3AccessKeyID, secretAccessKey: s3Config.s3SecretAccessKey,