Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

@waleedlatif1 waleedlatif1 commented Feb 12, 2026

Summary

  • add a dedicated optional region input for S3 get-object in the block UI
  • align block/tool params so get-object uses URL region, optional override, then fallback
  • harden S3 URL parsing to support virtual-hosted, path-style, dualstack, legacy, dotted buckets, and aws-cn hosts

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 12, 2026 8:43am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 12, 2026

Greptile Overview

Greptile Summary

This PR enhances S3 get-object functionality with robust URL parsing and region handling. The changes add a dedicated optional region input field in the block UI and implement comprehensive S3 URL parsing that supports multiple URL formats including virtual-hosted style, path-style, dualstack, legacy formats, bucket names with dots, and AWS China (.cn) domains.

Key improvements:

  • Added getObjectRegion field to S3 block UI for optional region override when downloading objects
  • Implemented hierarchical region resolution: URL-embedded region → user-provided override → default us-east-1
  • Enhanced parseS3Uri to handle diverse S3 URL formats with proper regex patterns for hostname parsing
  • Simplified block-level parameter logic by delegating URL parsing to the tool layer
  • Added defensive error handling for malformed URL encoding in object keys

The implementation correctly prioritizes region sources and maintains backward compatibility. The regex patterns properly handle edge cases like bucket names containing dots.

Confidence Score: 4/5

  • This PR is safe to merge with minor considerations
  • The implementation is well-structured with comprehensive URL format support and proper error handling. The hierarchical region resolution logic is sound. However, the PR lacks automated tests to verify the regex patterns work correctly for all supported URL formats (virtual-hosted, path-style, dualstack, dotted buckets, AWS China). Manual testing was performed but test coverage would increase confidence in edge case handling.
  • No files require special attention - the changes are well-isolated to S3 functionality

Important Files Changed

Filename Overview
apps/sim/tools/s3/utils.ts Enhanced S3 URL parsing to support virtual-hosted, path-style, dualstack, and AWS China URLs with optional region fallback
apps/sim/tools/s3/get_object.ts Added optional region parameter that passes through to parseS3Uri for region override functionality
apps/sim/blocks/blocks/s3.ts Added dedicated getObjectRegion UI field and simplified get_object params logic to delegate URL parsing to tool layer

Sequence Diagram

sequenceDiagram
    participant User
    participant S3Block
    participant S3GetObjectTool
    participant parseS3Uri
    participant S3Service

    User->>S3Block: Provides S3 URL & optional region override
    S3Block->>S3Block: Validates inputs (accessKeyId, secretAccessKey, s3Uri)
    S3Block->>S3GetObjectTool: Passes credentials, s3Uri, region (getObjectRegion || region)
    S3GetObjectTool->>parseS3Uri: parseS3Uri(s3Uri, region)
    parseS3Uri->>parseS3Uri: Try URL hostname region extraction
    parseS3Uri->>parseS3Uri: Supports virtual-hosted & path-style URLs
    parseS3Uri->>parseS3Uri: Priority: URL region > fallback region > us-east-1
    parseS3Uri-->>S3GetObjectTool: Returns {bucketName, region, objectKey}
    S3GetObjectTool->>S3GetObjectTool: Builds request URL with parsed values
    S3GetObjectTool->>S3GetObjectTool: Generates AWS Signature V4 headers
    S3GetObjectTool->>S3Service: GET request with signed headers
    S3Service-->>S3GetObjectTool: Returns object data
    S3GetObjectTool->>S3GetObjectTool: Generates pre-signed URL
    S3GetObjectTool-->>User: Returns file data & pre-signed URL
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@waleedlatif1
Copy link
Collaborator Author

@greptile
@cursor review

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 2944579 into staging Feb 12, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/s3 branch February 12, 2026 18:59
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.

1 participant