🐛 Fix: fix an issue where files uploaded to minio using s3 plugin can't be deleted remotely

This commit is contained in:
萌萌哒赫萝 2023-08-29 00:12:53 -07:00
parent 0c8ea832aa
commit 80db40b0f0

View File

@ -75,7 +75,10 @@ export async function removeFileFromS3InMain (configMap: IStringKeyMap, dogeMode
try {
const { imgUrl, config: { accessKeyID, secretAccessKey, bucketName, region, endpoint, pathStyleAccess, rejectUnauthorized, proxy } } = configMap
const url = new URL(!/^https?:\/\//.test(imgUrl) ? `http://${imgUrl}` : imgUrl)
const fileKey = url.pathname.replace(/^\/+/, '')
let fileKey = url.pathname.replace(/^\/+/, '')
if (pathStyleAccess) {
fileKey = fileKey.replace(/^[^/]+\//, '')
}
const endpointUrl: string | undefined = endpoint
? /^https?:\/\//.test(endpoint)
? endpoint