Skip to content

fix: update file buffer handling to use BinaryLike for improved data integrity#340

Open
Aryan0699 wants to merge 2 commits intoshopstr-eng:mainfrom
Aryan0699:fix/binarylike-buffer
Open

fix: update file buffer handling to use BinaryLike for improved data integrity#340
Aryan0699 wants to merge 2 commits intoshopstr-eng:mainfrom
Aryan0699:fix/binarylike-buffer

Conversation

@Aryan0699
Copy link
Copy Markdown
Contributor

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

none

Affirmation

Copilot AI review requested due to automatic review settings April 5, 2026 08:53
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 5, 2026

@Aryan0699 is attempting to deploy a commit to the shopstr-eng Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

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

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 BinaryLike type import and converts the upload buffer to Uint8Array before 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.

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.

2 participants