mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-08-28 03:26:56 +08:00
🐛 Fix(custom): fix s3 remote delete bug when url is modified locally
This commit is contained in:
@@ -73,8 +73,11 @@ async function getDogeToken (accessKey: string, secretKey: string): Promise<{} |
|
|||||||
|
|
||||||
export async function removeFileFromS3InMain (configMap: IStringKeyMap, dogeMode: boolean = false) {
|
export async function removeFileFromS3InMain (configMap: IStringKeyMap, dogeMode: boolean = false) {
|
||||||
try {
|
try {
|
||||||
const { imgUrl, config: { accessKeyID, secretAccessKey, bucketName, endpoint, pathStyleAccess, rejectUnauthorized, proxy } } = configMap
|
const { url: rawUrl, type, config: { accessKeyID, secretAccessKey, bucketName, endpoint, pathStyleAccess, rejectUnauthorized, proxy } } = configMap
|
||||||
let { config: { region } } = configMap
|
let { imgUrl, config: { region } } = configMap
|
||||||
|
if (type === 'aws-s3' || type === 'aws-s3-plist') {
|
||||||
|
imgUrl = rawUrl || imgUrl || ''
|
||||||
|
}
|
||||||
const url = new URL(!/^https?:\/\//.test(imgUrl) ? `http://${imgUrl}` : imgUrl)
|
const url = new URL(!/^https?:\/\//.test(imgUrl) ? `http://${imgUrl}` : imgUrl)
|
||||||
let fileKey = url.pathname.replace(/^\/+/, '')
|
let fileKey = url.pathname.replace(/^\/+/, '')
|
||||||
if (pathStyleAccess) {
|
if (pathStyleAccess) {
|
||||||
|
|||||||
Reference in New Issue
Block a user