Skip to content

Conversation

vin-dKR
Copy link
Contributor

@vin-dKR vin-dKR commented Oct 2, 2025

Description

This PR fixes issue #6780 where file uploads larger than 2 GB were failing.

Closes #6780

Changes

  • Updated upload handler to slice directly from the File object per chunk (no full-file reads).
  • Removed whole-file checksum at create; compute per-chunk SHA‑256 instead.
  • Optimized memory usage during multipart uploads (O(chunk) instead of O(file)).
  • Added loader and surfaced error state in the UI while processing.
  • Increased downloadable files limit to 10 GB (frontend maxSize, backend validation).
  • Removed the buffer and implemented through file instead in Upload.ts

Testing

  • Uploaded files of 50 MB, 1 GB, 2 GB and 6GB successfully.
  • Verified smaller files still work as expected.
github.mp4

Copy link

vercel bot commented Oct 2, 2025

@vin-dKR is attempting to deploy a commit to the polar-sh Team on Vercel.

A member of the Team first needs to authorize it.

@vin-dKR
Copy link
Contributor Author

vin-dKR commented Oct 2, 2025

hi @psincraian this is my latest PR i have closed the previous PR due to some conflicts. Please review this new PR.

Copy link
Contributor

@psincraian psincraian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, I missed this.

Left a comment.

"""Schema to create a file to be associated with the downloadables benefit."""

service: Literal[FileServiceTypes.downloadable]
size: int = Field(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this attribute needed? If you add it here, you should provide a value in the model if not you cannot download it.

name: this.file.name,
size: this.file.size,
mime_type: mimeType,
checksum_sha256_base64: sha256base64,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checksum has been removed; this creates a data integrity risk for corrupted files.

My recommendation is to implement an incremental checksum per chunk and verify it server side.

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.

benefits: file upload of 2 GB fails
2 participants