Repository navigation
fix(uploads): settle GridFS removal callback on the MongoDB 7 driver - #4271
Conversation
GridFSBucket.delete() returns a promise and never calls a callback, so multer's _removeFile cb was never called and a request could hang on an upload error path. Settle cb from the promise. The driver drops the top-level contentType option of openUploadStream: createFromBuffer now stores it in metadata.contentType, and the repository list() reads it from there (top-level fallback for older files), keeping the contentType field in its result. Closes #4268
|
No actionable comments were generated in the recent review. WalkthroughGridFS deletion now settles Multer’s callback from the bucket’s promise. Buffer uploads store content type in metadata. The uploads repository reads metadata content type when the top-level value is falsy. ChangesGridFS upload behavior
Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix · Severity of issue fixed: Medium Possibly related issues
Suggested labels: Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4271 +/- ##
==========================================
+ Coverage 94.61% 94.64% +0.03%
==========================================
Files 175 175
Lines 6216 6218 +2
Branches 2019 2020 +1
==========================================
+ Hits 5881 5885 +4
+ Misses 272 270 -2
Partials 63 63
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Summary
Scope
nonelowTechnical detail
_removeFilesettles the multer callback from thebucket.delete()promise.contentTypemoved tometadata.contentType, since driver 7 dropped the top-level option.list()readsmetadata.contentTypewith a legacy top-level fallback; response shape unchanged.Validation
npm run lintnpm testGuardrails check
.env*,secrets/**, keys, tokens)Summary by CodeRabbit