From 58248bc2ea42ec0e84fd773835d8da2ef9807089 Mon Sep 17 00:00:00 2001 From: Kuingsmile Date: Mon, 22 Jan 2024 02:45:21 -0800 Subject: [PATCH] :bug: Fix(custom): fix s3 remote delete bug when url is modified locally --- src/main/utils/deleteFunc.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/utils/deleteFunc.ts b/src/main/utils/deleteFunc.ts index 5b27916d..1697b393 100644 --- a/src/main/utils/deleteFunc.ts +++ b/src/main/utils/deleteFunc.ts @@ -73,8 +73,11 @@ async function getDogeToken (accessKey: string, secretKey: string): Promise<{} | export async function removeFileFromS3InMain (configMap: IStringKeyMap, dogeMode: boolean = false) { try { - const { imgUrl, config: { accessKeyID, secretAccessKey, bucketName, endpoint, pathStyleAccess, rejectUnauthorized, proxy } } = configMap - let { config: { region } } = configMap + const { url: rawUrl, type, config: { accessKeyID, secretAccessKey, bucketName, endpoint, pathStyleAccess, rejectUnauthorized, proxy } } = 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) let fileKey = url.pathname.replace(/^\/+/, '') if (pathStyleAccess) {