Skip to content

Commit 56d48e4

Browse files
committed
fix: harden normalizeEndpoint to handle arbitrary URI schemes
Endpoints with non-HTTP schemes (e.g. s3://, ftp://) were incorrectly getting https:// prepended, producing invalid URLs like https://s3://... Now uses strings.Contains("://") to detect any scheme, only prepending https:// for bare host:port values (matching v1 SDK DisableSSL=false behaviour). Made-with: Cursor
1 parent 8832710 commit 56d48e4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

aws.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ func NewAWS(p *Plugin) AWS {
7474
}
7575

7676
func normalizeEndpoint(endpoint string) string {
77-
if !strings.HasPrefix(endpoint, "http://") && !strings.HasPrefix(endpoint, "https://") {
78-
return "https://" + endpoint
77+
if endpoint == "" || strings.Contains(endpoint, "://") {
78+
return endpoint
7979
}
80-
return endpoint
80+
return "https://" + endpoint
8181
}
8282

8383
func (a *AWS) Upload(local, remote string) error {

0 commit comments

Comments
 (0)