fix: delete uploaded temp file after processing in syllabus upload route - #680
Open
khushikakade wants to merge 1 commit into
Open
fix: delete uploaded temp file after processing in syllabus upload route#680khushikakade wants to merge 1 commit into
khushikakade wants to merge 1 commit into
Conversation
Uploaded files in /api/syllabus/upload were never removed from disk after processing, causing unbounded storage growth and leaving user files permanently accessible via the static /uploads route. Added a finally block to fs.unlink() the temp file on every request path — both successful responses and error cases. Fixes lovelymahor#679
|
@khushikakade is attempting to deploy a commit to the Lovely Mahour's projects Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
I've submitted the fix. Let me know if you need anything else! I see the Vercel check needs maintainer authorization to run the preview. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #679
Uploaded files processed by
POST /api/syllabus/uploadwere neverdeleted from disk after the route finished (on either success or failure
paths). This caused:
processing window
GET /uploads/<filename>since the uploads directory is served as static
Changes Made
Added a
finallyblock tofs.unlink()the Multer temp file afterevery request, regardless of outcome: