Skip to content

fix: mime validation for multipart#995

Merged
ferhatelmas merged 1 commit intomasterfrom
ferhat/mime
Apr 9, 2026
Merged

fix: mime validation for multipart#995
ferhatelmas merged 1 commit intomasterfrom
ferhat/mime

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Multipart form-data upload path doesn't bubble errors correctly.
For example, there is a mime error thrown, it will be caught and converted to size error.

What is the new behavior?

Bubble the error if storage error immediately otherwise fallback.

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas requested a review from a team as a code owner April 9, 2026 09:02
Copilot AI review requested due to automatic review settings April 9, 2026 09:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes multipart/form-data upload error handling so that storage-layer validation errors (notably invalid/unsupported MIME types) are not incorrectly wrapped as “No content provided”, aligning multipart behavior with the binary upload path.

Changes:

  • In fileUploadFromRequest, rethrow StorageBackendError from the multipart parsing/validation block instead of wrapping it in ERRORS.NoContentProvided.
  • Add an integration test case to cover disallowed MIME type handling specifically when contentType is provided via multipart form fields.
  • Clarify the existing MIME validation test name to indicate it exercises the “binary path”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/storage/uploader.ts Ensures multipart parsing/validation bubbles StorageBackendError (e.g., invalid MIME type) rather than masking it.
src/test/object.test.ts Adds coverage for multipart contentType field MIME validation and renames the existing “binary path” test for clarity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 24181940260

Coverage increased (+0.007%) to 80.826%

Details

  • Coverage increased (+0.007%) from the base build.
  • Patch coverage: 3 of 3 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 37223
Covered Lines: 30265
Line Coverage: 81.31%
Relevant Branches: 4136
Covered Branches: 3164
Branch Coverage: 76.5%
Branches in Coverage %: Yes
Coverage Strength: 317.55 hits per line

💛 - Coveralls

@ferhatelmas ferhatelmas merged commit 3e426fc into master Apr 9, 2026
9 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/mime branch April 9, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants