Skip to content

Commit 826a9cf

Browse files
committed
fix: CoreWeave Object Storage should use virtual style addressing
1 parent 54d6a8a commit 826a9cf

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

storage/s3.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ const (
4848
// Google Cloud Storage endpoint
4949
gcsEndpoint = "storage.googleapis.com"
5050

51+
// CoreWeave Object Storage endpoint
52+
cwObjectEndpoint = "cwobject.com"
53+
54+
// CoreWeave Object Storage LOTA endpoint
55+
cwLotaEndpoint = "cwlota.com"
56+
5157
// the key of the object metadata which is used to handle retry decision on NoSuchUpload error
5258
metadataKeyRetryID = "s5cmd-upload-retry-id"
5359
)
@@ -1422,11 +1428,15 @@ func IsGoogleEndpoint(endpoint urlpkg.URL) bool {
14221428
return endpoint.Hostname() == gcsEndpoint
14231429
}
14241430

1431+
func IsCoreWeaveEndpoint(endpoint urlpkg.URL) bool {
1432+
return endpoint.Hostname() == cwObjectEndpoint || endpoint.Hostname() == cwLotaEndpoint
1433+
}
1434+
14251435
// isVirtualHostStyle reports whether the given endpoint supports S3 virtual
14261436
// host style bucket name resolving. If a custom S3 API compatible endpoint is
14271437
// given, resolve the bucketname from the URL path.
14281438
func isVirtualHostStyle(endpoint urlpkg.URL) bool {
1429-
return endpoint == sentinelURL || supportsTransferAcceleration(endpoint) || IsGoogleEndpoint(endpoint)
1439+
return endpoint == sentinelURL || supportsTransferAcceleration(endpoint) || IsGoogleEndpoint(endpoint) || IsCoreWeaveEndpoint(endpoint)
14301440
}
14311441

14321442
func errHasCode(err error, code string) bool {

storage/s3_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ func TestNewSessionPathStyle(t *testing.T) {
6161
endpoint: urlpkg.URL{Scheme: "https", Host: gcsEndpoint},
6262
expectPathStyle: false,
6363
},
64+
{
65+
name: "expect_virtual_host_style_for_coreweave_object_storage",
66+
endpoint: urlpkg.URL{Scheme: "https", Host: cwObjectEndpoint},
67+
expectPathStyle: false,
68+
},
69+
{
70+
name: "expect_virtual_host_style_for_coreweave_object_storage_lota",
71+
endpoint: urlpkg.URL{Scheme: "http", Host: cwLotaEndpoint},
72+
expectPathStyle: false,
73+
},
6474
{
6575
name: "expect_path_style_for_localhost",
6676
endpoint: urlpkg.URL{Scheme: "http", Host: "127.0.0.1"},

0 commit comments

Comments
 (0)