fix: update file buffer handling to use BinaryLike for improved data integrity#340
Open
Aryan0699 wants to merge 2 commits intoshopstr-eng:mainfrom
Open
fix: update file buffer handling to use BinaryLike for improved data integrity#340Aryan0699 wants to merge 2 commits intoshopstr-eng:mainfrom
Aryan0699 wants to merge 2 commits intoshopstr-eng:mainfrom
Conversation
|
@Aryan0699 is attempting to deploy a commit to the shopstr-eng Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adjusts SHA256 hashing input types for uploaded files to satisfy newer TypeScript expectations around Node.js crypto’s BinaryLike input.
Changes:
- Adds a
BinaryLiketype import and converts the upload buffer toUint8Arraybefore hashing - Updates size reporting to use the new binary data length
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
When computing the SHA256 hash of uploaded files, we were using a Node.js Buffer directly. However, the Node.js crypto API requires a stricter type called BinaryLike, which doesn't fully accept Buffer in newer TypeScript versions
Solution :
Converted the Buffer to Uint8Array (a standard binary type) using Uint8Array.from(fileBuffer).
The fix is minimal (one line change) and has zero impact on actual functionality—it's purely a type compatibility improvement.
Resolved or fixed issue
noneAffirmation