🐛 Fix(custom): fix aws s3 urlprefix bug

This commit is contained in:
Kuingsmile 2024-04-22 16:27:31 +08:00
parent 939c907d23
commit 3681681401
4 changed files with 24 additions and 14 deletions

View File

@ -68,7 +68,7 @@
"multer": "^1.4.5-lts.1",
"node-ssh-no-cpu-features": "^1.0.1",
"nodejs-file-downloader": "^4.12.1",
"piclist": "^1.8.5",
"piclist": "^1.8.6",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.0",
"proxy-agent": "^5.0.0",

View File

@ -134,12 +134,23 @@ export async function removeFileFromS3InMain (configMap: IStringKeyMap, dogeMode
sessionToken: configMap.config.sessionToken
}
}
let result: any
try {
const client = new S3Client(s3Options)
const command = new DeleteObjectCommand({
Bucket: bucketName,
Key: fileKey
})
const result = await client.send(command)
result = await client.send(command)
} catch (err: any) {
s3Options.region = 'us-east-1'
const client = new S3Client(s3Options)
const command = new DeleteObjectCommand({
Bucket: bucketName,
Key: fileKey
})
result = await client.send(command)
}
return result.$metadata.httpStatusCode === 204
} catch (err: any) {
console.log(err)

View File

@ -2832,9 +2832,8 @@ async function getBucketFileListBackStage () {
isLoadingData.value = true
const fileTransferStore = useFileTransferStore()
fileTransferStore.resetFileTransferList()
if (currentPicBedName.value === 'webdavplist' ||
currentPicBedName.value === 'local' ||
currentPicBedName.value === 'sftp') {
const picBedNamesArr = ['webdavplist', 'local', 'sftp']
if (picBedNamesArr.includes(currentPicBedName.value)) {
param.baseDir = configMap.baseDir
param.webPath = configMap.webPath
}

View File

@ -12397,10 +12397,10 @@ performance-now@^2.1.0:
resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
piclist@^1.8.5:
version "1.8.5"
resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.8.5.tgz#982f481420c83cb42d6c1ff07bd2ad467ed71539"
integrity sha512-RrSWViLbgTb3VeZ5Poajo6oyRbpFovF3g48/JiyMG6XChdt7BZ1dD/URmPzfrQNZM+bwunSwJr1yjhK87cSvwA==
piclist@^1.8.6:
version "1.8.6"
resolved "https://registry.yarnpkg.com/piclist/-/piclist-1.8.6.tgz#858706b5628953926ce0777d4a287482c2ebee10"
integrity sha512-ja/bUCifnoI/J2zTI79Kkuao4rdm64ZL6kqUFcZ2aSHQULLsFMkgDPiPPvVN5wF8Sv7mX9z4fVmj6UVM7r5uQQ==
dependencies:
"@aws-sdk/client-s3" "3.421.0"
"@aws-sdk/lib-storage" "3.421.0"