Doing sanitizeKey when doing deleteFile(s) (#9209)
* Doing sanitizeKey when doing deleteFile(s) Doing sanitizeKey when doing deleteFile(s). In case of backup file name in backups bucket backup-2023-01-03T185512.686Z.tar.gz but in global-db store backup filename is backup-2023-01-03T18:55:12.686Z.tar.gz sanitizeKey on deleteFile(s) method will prevent all other case related to this bug * use .promise() instead callback for workaround aws-sdk bug
This commit is contained in:
parent
912163ec71
commit
6825b2e3fc
|
@ -329,9 +329,9 @@ export const deleteFile = async (bucketName: string, filepath: string) => {
|
|||
await makeSureBucketExists(objectStore, bucketName)
|
||||
const params = {
|
||||
Bucket: bucketName,
|
||||
Key: filepath,
|
||||
Key: sanitizeKey(filepath),
|
||||
}
|
||||
return objectStore.deleteObject(params)
|
||||
return objectStore.deleteObject(params).promise()
|
||||
}
|
||||
|
||||
export const deleteFiles = async (bucketName: string, filepaths: string[]) => {
|
||||
|
@ -340,7 +340,7 @@ export const deleteFiles = async (bucketName: string, filepaths: string[]) => {
|
|||
const params = {
|
||||
Bucket: bucketName,
|
||||
Delete: {
|
||||
Objects: filepaths.map((path: any) => ({ Key: path })),
|
||||
Objects: filepaths.map((path: any) => ({ Key: sanitizeKey(path) })),
|
||||
},
|
||||
}
|
||||
return objectStore.deleteObjects(params).promise()
|
||||
|
|
Loading…
Reference in New Issue