Skip to content

feat: accept content encoding in file uploads - #343

Open
yuvrajjsingh0 wants to merge 1 commit into
mainfrom
content-encoding-in-file-upload
Open

feat: accept content encoding in file uploads#343
yuvrajjsingh0 wants to merge 1 commit into
mainfrom
content-encoding-in-file-upload

Conversation

@yuvrajjsingh0

@yuvrajjsingh0 yuvrajjsingh0 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features
    • File uploads now properly support and preserve Content-Encoding metadata. Supported encodings include gzip, br, zstd, and deflate, ensuring correctly labeled file storage.

@semanticdiff-com

semanticdiff-com Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  airborne_server/src/file.rs  0% smaller
  airborne_server/src/file/utils.rs  0% smaller
  airborne_server/src/utils/s3.rs  0% smaller

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b5a231c5-0691-420a-b728-be59a2c7204a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The PR adds Content-Encoding header validation to the file upload handler. A new validate_content_encoding utility checks the header against an allowlist (gzip, br, zstd, deflate), returning BadRequest for unsupported values. The validated encoding is then forwarded to stream_file, which sets it on the S3 put_object request.

Changes

Content-Encoding Validation and S3 Propagation

Layer / File(s) Summary
validate_content_encoding utility
airborne_server/src/file/utils.rs
Adds validate_content_encoding with an internal allowlist, header normalization (trim + lowercase), ABError::BadRequest on invalid or non-UTF8 values, and Ok(None) for absent/empty headers. Imports http::HeaderValue.
Handler and S3 integration
airborne_server/src/file.rs, airborne_server/src/utils/s3.rs
upload_file reads the Content-Encoding header, calls validate_content_encoding, and passes the result to stream_file. stream_file gains a content_encoding: Option<String> parameter and applies it via .set_content_encoding(content_encoding) on the S3 put_object builder.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A bunny hops through headers with care,
Sniffing for gzip floating in the air 🐇
br, zstd, deflate — all allowed through,
Bad encodings? A BadRequest for you!
Now S3 knows just how the bytes were dressed,
Content-Encoding validated — the best! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: accept content encoding in file uploads' directly and clearly summarizes the main change: adding support for content encoding headers in file upload requests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch content-encoding-in-file-upload

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yuvrajjsingh0
yuvrajjsingh0 force-pushed the content-encoding-in-file-upload branch from 41ba77b to 32271fe Compare June 30, 2026 10:45
@yuvrajjsingh0
yuvrajjsingh0 force-pushed the content-encoding-in-file-upload branch from 32271fe to 74f6dbb Compare June 30, 2026 10:46
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.

1 participant