Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Error messages hardcode "5MB" but minimum is now 1MB
- Error message text now derives its human-readable minimum from MIN_PART_SIZE so the MB label matches the 1MB threshold.
Or push these changes by commenting:
@cursor push 2b6197594c
Preview (2b6197594c)
diff --git a/src/lib/upload-file.ts b/src/lib/upload-file.ts
--- a/src/lib/upload-file.ts
+++ b/src/lib/upload-file.ts
@@ -11,6 +11,7 @@
const DEFAULT_CONCURRENCY = 5;
const DEFAULT_PART_SIZE = 100 * 1024 * 1024; // 100MB per part
const MIN_PART_SIZE = 1 * 1024 * 1024; // 1MB minimum
+const MIN_PART_SIZE_LABEL = `${MIN_PART_SIZE / (1024 * 1024)}MB`;
const MAX_PART_COUNT = 10_000;
export interface PartUploadEvent {
@@ -29,9 +30,9 @@
export interface MultipartUploadConfig {
/** Maximum number of concurrent part uploads. Defaults to 5. */
concurrency?: number;
- /** File size threshold in bytes above which multipart upload is used. Minimum 5MB. Defaults to 100MB. */
+ /** File size threshold in bytes above which multipart upload is used. Minimum 1MB. Defaults to 100MB. */
threshold?: number;
- /** Size of each part in bytes. Minimum 5MB. Must not produce more than 10,000 parts. Defaults to 100MB. */
+ /** Size of each part in bytes. Minimum 1MB. Must not produce more than 10,000 parts. Defaults to 100MB. */
partSize?: number;
/** Called after each part is successfully uploaded. */
onPartUpload?: (event: PartUploadEvent) => void;
@@ -72,11 +73,11 @@
const partSize = multipartUpload?.partSize ?? DEFAULT_PART_SIZE;
if (partSize < MIN_PART_SIZE) {
- throw new Error(`partSize must be at least 5MB (${MIN_PART_SIZE} bytes), got ${partSize}`);
+ throw new Error(`partSize must be at least ${MIN_PART_SIZE_LABEL} (${MIN_PART_SIZE} bytes), got ${partSize}`);
}
if (threshold < MIN_PART_SIZE) {
- throw new Error(`threshold must be at least 5MB (${MIN_PART_SIZE} bytes), got ${threshold}`);
+ throw new Error(`threshold must be at least ${MIN_PART_SIZE_LABEL} (${MIN_PART_SIZE} bytes), got ${threshold}`);
}
// Normalize the uploadable to a File object so we can inspect sizeThis Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
| const DEFAULT_CONCURRENCY = 5; | ||
| const DEFAULT_PART_SIZE = 100 * 1024 * 1024; // 100MB per part | ||
| const MIN_PART_SIZE = 5 * 1024 * 1024; // 5MB minimum | ||
| const MIN_PART_SIZE = 1 * 1024 * 1024; // 1MB minimum |
There was a problem hiding this comment.
Error messages hardcode "5MB" but minimum is now 1MB
Medium Severity
Changing MIN_PART_SIZE to 1MB without updating the hardcoded "5MB" in the error messages on lines 75 and 79 produces contradictory output. For example, the error now reads "partSize must be at least 5MB (1048576 bytes)" — but 1048576 bytes is 1MB, not 5MB. The human-readable label and the interpolated byte value disagree, confusing users.
Additional Locations (2)
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.



Note
Medium Risk
Changes upload behavior by triggering multipart uploads more often and allowing smaller parts, which can increase request count and surface edge cases in client/server upload handling.
Overview
Multipart uploads are now used for smaller files by default by dropping
DEFAULT_THRESHOLDfrom 100MB to 10MB.It also lowers the minimum allowed
partSize/thresholdby changingMIN_PART_SIZEfrom 5MB to 1MB, allowing more (and smaller) parts per upload.Written by Cursor Bugbot for commit 575bb7d. This will update automatically on new commits. Configure here.