mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #12 from overleaf/spd-async-pool-empty-array
Don't try to delete files if none are found in a directory
This commit is contained in:
commit
9f28adf96c
1 changed files with 9 additions and 3 deletions
|
@ -220,9 +220,15 @@ module.exports = class GcsPersistor extends AbstractPersistor {
|
||||||
.bucket(bucketName)
|
.bucket(bucketName)
|
||||||
.getFiles({ directory: key })
|
.getFiles({ directory: key })
|
||||||
|
|
||||||
await asyncPool(this.settings.deleteConcurrency, files, async (file) => {
|
if (Array.isArray(files) && files.length > 0) {
|
||||||
|
await asyncPool(
|
||||||
|
this.settings.deleteConcurrency,
|
||||||
|
files,
|
||||||
|
async (file) => {
|
||||||
await this.deleteObject(bucketName, file.name)
|
await this.deleteObject(bucketName, file.name)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const error = PersistorHelper.wrapError(
|
const error = PersistorHelper.wrapError(
|
||||||
err,
|
err,
|
||||||
|
|
Loading…
Reference in a new issue