Skip to content

Commit

Permalink
🐛 Fix(custom): fix s3 disableBucketPrefixToURL
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuingsmile committed Jan 31, 2024
1 parent 6b2e2dd commit 321ef56
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/uploader/awss3plist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ const handle = async (ctx: IPicGo): Promise<IPicGo> => {
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) {
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export interface IAwsS3PListUserConfig {
pathStyleAccess?: boolean
rejectUnauthorized?: boolean
acl?: string
disableBucketPrefixToURL?: boolean
disableBucketPrefixToURL?: boolean | string
}
/** PicGo 配置文件类型定义 */
export interface IConfig {
Expand Down

0 comments on commit 321ef56

Please sign in to comment.