Conversation
supersonik12
commented
Nov 14, 2025
- uploadResource endpoint complete
- can upload to SBH and add attachments
- uploadExperiment endpoint partially complete, FJ upload still in progress
|
@codex review this code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
sbs_server/app/views.py
Outdated
| if 'Attachments' in files and 'attachments' in params_from_request: | ||
| attachment_files = files.getlist("Attachments") | ||
| attachments = {params_from_request['attachments'][file.filename] : file for file in attachment_files} |
There was a problem hiding this comment.
Guard against missing attachment metadata
When attachments are present, attachments is built with params_from_request['attachments'][file.filename] for every uploaded file. If the client uploads a file without a matching entry in the attachments metadata (or the metadata is malformed), this indexing raises a KeyError and the request returns a 500 instead of a 4xx validation error. The previous implementation had no attachment handling and therefore didn’t expose this crash path. Consider validating that each uploaded file has a corresponding metadata entry and returning a user error when it doesn’t.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@codex fair enough, make a proposal to implement your suggestion.
There was a problem hiding this comment.
To use Codex here, create an environment for this repo.
There was a problem hiding this comment.
@codex I created the environment, try to implement your suggestion now.
There was a problem hiding this comment.
Summary
- Added validation to ensure uploaded attachments have corresponding metadata and return clear 400 responses when metadata is missing or malformed. sbs_server/app/views.pyL80-L118
Testing
⚠️ Tests not run (not requested)