From 321ef560a1c3563affe8d724b7f8ddee1c36b4bd Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Tue, 30 Jan 2024 21:31:50 -0800 Subject: [PATCH] :bug: Fix(custom): fix s3 disableBucketPrefixToURL --- package.json | 2 +- src/plugins/uploader/awss3plist.ts | 10 ++++++++++ src/types/index.ts | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 25ed4f1..14a2ae0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "piclist", - "version": "1.7.9", + "version": "1.7.10", "description": "Modified PicGo core, A tool for picture uploading", "author": { "name": "Kuingsmile", diff --git a/src/plugins/uploader/awss3plist.ts b/src/plugins/uploader/awss3plist.ts index 083822a..caf3424 100644 --- a/src/plugins/uploader/awss3plist.ts +++ b/src/plugins/uploader/awss3plist.ts @@ -9,6 +9,16 @@ const handle = async (ctx: IPicGo): Promise => { if (!userConfig) { throw new Error("Can't find amazon s3 uploader config") } + if (userConfig.disableBucketPrefixToURL === undefined) { + userConfig.disableBucketPrefixToURL = false + } + if (typeof userConfig.disableBucketPrefixToURL === "string") { + if (userConfig.disableBucketPrefixToURL.toLowerCase() === "true") { + userConfig.disableBucketPrefixToURL = true + } else if (userConfig.disableBucketPrefixToURL.toLowerCase() === "false") { + userConfig.disableBucketPrefixToURL = false + } + } if (userConfig.urlPrefix) { userConfig.urlPrefix = userConfig.urlPrefix.replace(/\/?$/, "") if (userConfig.pathStyleAccess && !userConfig.disableBucketPrefixToURL) { diff --git a/src/types/index.ts b/src/types/index.ts index da9645c..bf92f5b 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -461,7 +461,7 @@ export interface IAwsS3PListUserConfig { pathStyleAccess?: boolean rejectUnauthorized?: boolean acl?: string - disableBucketPrefixToURL?: boolean + disableBucketPrefixToURL?: boolean | string } /** PicGo 配置文件类型定义 */ export interface IConfig {