chore(fs/S3#_rmdir): use _isNotEmptyDir

This commit is contained in:
Julien Fontanet 2021-04-30 21:41:07 +02:00
parent cb835b7b6a
commit 5f53ebdf12

View File

@ -171,8 +171,7 @@ export default class S3Handler extends RemoteHandlerAbstract {
} }
async _rmdir(path) { async _rmdir(path) {
const entries = await this._list(path) if (await this._isNotEmptyDir(path)) {
if (entries.length !== 0) {
const error = new Error(`ENOTEMPTY: directory not empty, rmdir '${path}`) const error = new Error(`ENOTEMPTY: directory not empty, rmdir '${path}`)
error.code = 'ENOTEMPTY' error.code = 'ENOTEMPTY'
error.path = path error.path = path