fix: resolve mp3 upload error at api.ts:53 (issue #95)#109
Open
ErnestHysa wants to merge 1 commit into
Open
Conversation
…man-jiang#95) The Content-Type header was being sent when uploading directly to R2 via a presigned URL. However, presigned URLs already encode the content type in the signature. Including the header can cause R2 to reject uploads with a signature mismatch error, particularly affecting MP3 uploads.
|
@ErnestHysa is attempting to deploy a commit to the freemanjiang's projects Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
The Vercel deploy preview needs team authorization from a maintainer on freemanjiang's projects — not something I can do from my end. The code change is just the Content-Type header removal in apps/client/src/lib/api.ts; once a maintainer authorizes, the preview should run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue #95 - mp3 upload error at api.ts:53.
Root Cause
When uploading directly to R2 via a presigned URL, the client was sending a
Content-Typeheader in the PUT request. However, presigned URLs already encode the content type in their signature. Including the header causes R2 to reject the upload with a signature mismatch error.Fix
Removed the explicit
Content-Typeheader from the fetch call when uploading to the presigned URL. The content type information is already embedded in the presigned URL itself.Changes
apps/client/src/lib/api.ts: Removedheaders: { Content-Type: data.file.type }from the presigned URL upload fetch callTesting
This fix has been tested to resolve the mp3 upload failure.