This is a bounty to fix a specific bug in a Node.js Express API: the `/api/uploads` endpoint incorrectly returns a 201 success status even when no file is present in the multipart request. The task is to ensure requests without a file receive a 400 Bad Request and to add a regression test.
A starter prompt for Claude Code, what you'll need, and how to reach them.
You are a senior Node.js developer. The task is to fix a bug in a given Express.js application's upload endpoint and add a regression test. Fork the repository `SecureBananaLabs/bug-bounty`. The issue is #2850, where `POST /api/uploads` returns `201` even without a `file` field in a multipart request. The goal is to make it return `400` with `status: "no-file"` for missing files and reserve `201` for actual successful uploads. Add a route-level regression test for this specific missing-file case. Ensure the fix adheres to existing code style and testing patterns. Focus on the `POST /api/uploads` route. Stack is Node.js with Express.js. Deliver a pull request. Your first step is to locate the relevant route handler and identify where `req.file` or similar file presence check should occur.
Standard for any GitHub-based development.
Bounty (amount on the issue). ## Bug `POST /api/uploads` currently returns `201` with `success: true` even when the multipart request does not include a `file` field. The response reports `status: "no-file"`, but it is still treated as a successful upload by HTTP status and response shape. ## Expected fix Reject upload requests that do not include a file with a clear `400` response, and keep successful upload responses reserved for requests that actually include `req.file`. Add route-level regression coverage for the missing-file case. ## Scope This issue is limited to missing-file handling in `POST /api/uploads` and focused API test coverage. This issue is limited only to the creator of this issue. This means that only the issue author can attempt to solve this issue. If you would like to work on it, please create another issue with the same contents and refer to issue #743 for more information. References #743.
Standard for Node.js development.
Standard for Node.js package management.
Familiarity with how Express processes file uploads and `req.file` via libraries like `multer`.
Comment on GitHub issue #2850, acknowledging the "creator only" clause and inquiring about the process to submit a fix as a new contributor for a bounty, potentially by opening a new issue as suggested.
“I've identified the root cause for issue #2850 (empty file uploads returning 201) and have a working fix with an accompanying regression test. Given the 'creator only' note, I'm happy to open a new issue and submit a PR there, or follow any other process you recommend to deliver this solution.”
Open the original ↗