Skip to content

Commit

Permalink
Don't force aws sdk v2 for s3 buckets [#112] (#113)
Browse files Browse the repository at this point in the history
Don't force aws sdk v2 for s3 buckets [#112]

* this is to allow sdk v1 query params like s3ForcePathStyle, to work with Minio and other storage systems: see https://gocloud.dev/howto/blob/#s3-compatible
  • Loading branch information
bdon authored Jan 5, 2024
1 parent 65e46f9 commit 06b5729
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
11 changes: 0 additions & 11 deletions pmtiles/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,6 @@ func NormalizeBucketKey(bucket string, prefix string, key string) (string, strin
}
}

if strings.HasPrefix(bucket, "s3") {
u, err := url.Parse(bucket)
if err != nil {
fmt.Println("Error parsing URL:", err)
return "", "", err
}
values := u.Query()
values.Set("awssdk", "v2")
u.RawQuery = values.Encode()
return u.String(), key, nil
}
return bucket, key, nil
}

Expand Down
6 changes: 0 additions & 6 deletions pmtiles/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ func TestNormalizeHttp(t *testing.T) {
assert.Equal(t, "http://example.com/foo", bucket)
}

func TestNormalizeAwsSdkVersion(t *testing.T) {
bucket, key, _ := NormalizeBucketKey("s3://mybucket?awssdk=v1&endpoint=https://foo.bar", "", "abc")
assert.Equal(t, "abc", key)
assert.Equal(t, "s3://mybucket?awssdk=v2&endpoint=https%3A%2F%2Ffoo.bar", bucket)
}

func TestNormalizePathPrefixServer(t *testing.T) {
bucket, key, _ := NormalizeBucketKey("", "../foo", "")
assert.Equal(t, "", key)
Expand Down

0 comments on commit 06b5729

Please sign in to comment.