-
Notifications
You must be signed in to change notification settings - Fork 4
reject images larger than 128GiB #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Added client-side validation to reject VM image files larger than 128 GiB before upload begins.
- Validates file size immediately after
statcall on line 99 - Provides clear error message showing actual file size in GiB
- Prevents unnecessary API calls and upload attempts for oversized files
- Implementation is straightforward with proper placement in the upload flow
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- Simple validation check with clear error handling, no logic bugs, and appropriate placement in code flow
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| src/lib/nodes/image/upload.ts | 5/5 | Added 128GiB file size validation before upload begins, with clear error message showing actual file size |
Sequence Diagram
sequenceDiagram
participant User
participant CLI
participant File System
participant API Server
participant Object Storage
User->>CLI: sf nodes images upload -f <file> -n <name>
CLI->>CLI: Start preparingSpinner
CLI->>API Server: POST /v1/vms/images/start_upload
API Server-->>CLI: {image_id}
CLI->>CLI: Stop preparingSpinner (success)
CLI->>File System: stat(filePath)
File System-->>CLI: {size, ...}
alt file size > 128 GiB
CLI->>CLI: throw Error("File size exceeds 128 GiB")
CLI->>User: Display error and exit
else file size <= 128 GiB
CLI->>CLI: Calculate chunk size and parts
CLI->>CLI: Initialize progress bar
loop For each upload part
CLI->>API Server: POST /v1/vms/images/{image_id}/upload
API Server-->>CLI: {upload_url}
CLI->>File System: readChunk(start, length)
File System-->>CLI: chunk data
CLI->>Object Storage: PUT chunk to upload_url
Object Storage-->>CLI: 200 OK
CLI->>CLI: Update progress bar
end
CLI->>CLI: Stop progress bar
CLI->>CLI: Start finalizingSpinner
CLI->>File System: Calculate SHA256 hash
File System-->>CLI: sha256_hash
CLI->>API Server: PUT /v1/vms/images/{image_id}/complete_upload
API Server-->>CLI: {image_id, ...}
CLI->>CLI: Stop finalizingSpinner (success)
CLI->>User: Display success and next steps
end
1 file reviewed, no comments
6edcced to
e145d21
Compare
sigmachirality
approved these changes
Nov 10, 2025
e145d21 to
2a0df2b
Compare
sigmachirality
pushed a commit
that referenced
this pull request
Nov 27, 2025
reject images larger than 128GiB
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.

reject images larger than 128GiB