File tree Expand file tree Collapse file tree 2 files changed +37
-7
lines changed Expand file tree Collapse file tree 2 files changed +37
-7
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,15 @@ import (
6
6
"encoding/hex"
7
7
"errors"
8
8
"io"
9
- "net/url"
10
9
"path"
10
+ "strings"
11
11
"time"
12
12
13
13
"github.com/Layr-Labs/eigenda-proxy/store"
14
14
"github.com/ethereum/go-ethereum/crypto"
15
15
"github.com/minio/minio-go/v7"
16
16
17
17
"github.com/minio/minio-go/v7/pkg/credentials"
18
- "github.com/minio/minio-go/v7/pkg/s3utils"
19
18
)
20
19
21
20
const (
@@ -58,13 +57,13 @@ type Store struct {
58
57
stats * store.Stats
59
58
}
60
59
60
+ func isGoogleEndpoint (endpoint string ) bool {
61
+ return strings .Contains (endpoint , "storage.googleapis.com" )
62
+ }
63
+
61
64
func NewS3 (cfg Config ) (* Store , error ) {
62
- endpointURL , err := url .Parse (cfg .Endpoint )
63
- if err != nil {
64
- return nil , err
65
- }
66
65
putObjectOptions := minio.PutObjectOptions {}
67
- if s3utils . IsGoogleEndpoint ( * endpointURL ) {
66
+ if isGoogleEndpoint ( cfg . Endpoint ) {
68
67
putObjectOptions .DisableContentSha256 = true // Avoid chunk signatures on GCS: https://github.com/minio/minio-go/issues/1922
69
68
}
70
69
Original file line number Diff line number Diff line change
1
+ package s3
2
+
3
+ import (
4
+ "testing"
5
+
6
+ "github.com/stretchr/testify/assert"
7
+ )
8
+
9
+ func TestIsGoogleEndpoint_StorageGoogleapis (t * testing.T ) {
10
+ endpoint := "storage.googleapis.com"
11
+ result := isGoogleEndpoint (endpoint )
12
+ assert .True (t , result , "Expected true for Google Cloud Storage endpoint" )
13
+ }
14
+
15
+ func TestIsGoogleEndpoint_HttpsStorageGoogleapis (t * testing.T ) {
16
+ endpoint := "https://storage.googleapis.com"
17
+ result := isGoogleEndpoint (endpoint )
18
+ assert .True (t , result , "Expected true for Google Cloud Storage endpoint" )
19
+ }
20
+
21
+ func TestIsGoogleEndpoint_False (t * testing.T ) {
22
+ endpoint := "https://s3.amazonaws.com/my-bucket"
23
+ result := isGoogleEndpoint (endpoint )
24
+ assert .False (t , result , "Expected false for non-Google endpoint" )
25
+ }
26
+
27
+ func TestIsGoogleEndpoint_Empty (t * testing.T ) {
28
+ endpoint := ""
29
+ result := isGoogleEndpoint (endpoint )
30
+ assert .False (t , result , "Expected false for empty endpoint" )
31
+ }
You can’t perform that action at this time.
0 commit comments