Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): avoid decoding raw request body #434

Merged
merged 3 commits into from
May 15, 2024
Merged

fix(server): avoid decoding raw request body #434

merged 3 commits into from
May 15, 2024

Conversation

manniL
Copy link
Member

@manniL manniL commented May 1, 2024

πŸ”— Linked issue

None (experienced while demoing for a video)

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Right now, all binary files saved through the unstorage http server are not encoded correctly, as the default encoding is "utf-8",
even for these files. This PR fixes the behavior by not applyng any encoding when the file is marked as raw, otherwise using the default utf8 encoding.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@manniL manniL requested a review from pi0 May 1, 2024 07:46
Copy link

cloudflare-pages bot commented May 1, 2024

Deploying unstorage with Β Cloudflare Pages Β Cloudflare Pages

Latest commit: 9215185
Status:Β βœ…Β  Deploy successful!
Preview URL: https://f2df9e22.unstorage.pages.dev
Branch Preview URL: https://mannil-patch-1.unstorage.pages.dev

View logs

@manniL manniL changed the title fix(server): correct encoding fix(server): use correct encoding May 1, 2024
@pi0
Copy link
Member

pi0 commented May 1, 2024

Please consider making a minimal reproduction or add failing test (that fails without current changes)

@pi0 pi0 marked this pull request as draft May 1, 2024 07:56
@manniL manniL self-assigned this May 1, 2024
@manniL manniL marked this pull request as ready for review May 2, 2024 06:06
@manniL
Copy link
Member Author

manniL commented May 2, 2024

@pi0 Done! Added a fs-driver-based test to showcase the problem. The test fails in the original commit and is resolved by the proposed fix.

@manniL manniL removed their assignment May 4, 2024
@pi0 pi0 changed the title fix(server): use correct encoding fix(server): avoid decoding raw request body May 15, 2024
@pi0 pi0 merged commit f70104e into main May 15, 2024
3 checks passed
@pi0 pi0 deleted the manniL-patch-1 branch May 15, 2024 07:53
@manniL
Copy link
Member Author

manniL commented Jun 5, 2024

@pi0 Any chance to see this as part of a patch version soonish?

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.

None yet

2 participants