Skip to content
This repository was archived by the owner on Sep 14, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/stores/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,14 @@ class FilesystemStore {
const parts = key.split('/');
// the last part isn't a directory (it's embedded into the file name)
parts.pop();
while (
parts.length &&
!readdirSync(path.join(bucketPath, ...parts)).length
) {
await fs.rmdir(path.join(bucketPath, ...parts));
while (parts.length) {
await fs.rmdir(path.join(bucketPath, ...parts)).catch(err => {
if (err.code !== 'ENOENT' && err.code !== 'ENOTEMPTY') throw err;
parts.length = 0;
});
parts.pop();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to re-add this line. Otherwise empty parent directories don't get cleaned up. You actually included it in your example here: #788 (comment)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delayed reply. I hadn't seen this. Good catch. I left the pop in there locally but somehow corrupted the patch when applying.

}
}
}

async initiateUpload(bucket, key, uploadId, metadata) {
const uploadDir = path.join(
Expand Down