Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ const (
// Google Cloud Storage endpoint
gcsEndpoint = "storage.googleapis.com"

// CoreWeave Object Storage endpoint
cwObjectEndpoint = "cwobject.com"

// CoreWeave Object Storage LOTA endpoint
cwLotaEndpoint = "cwlota.com"

// the key of the object metadata which is used to handle retry decision on NoSuchUpload error
metadataKeyRetryID = "s5cmd-upload-retry-id"
)
Expand Down Expand Up @@ -1422,11 +1428,15 @@ func IsGoogleEndpoint(endpoint urlpkg.URL) bool {
return endpoint.Hostname() == gcsEndpoint
}

func IsCoreWeaveEndpoint(endpoint urlpkg.URL) bool {
return endpoint.Hostname() == cwObjectEndpoint || endpoint.Hostname() == cwLotaEndpoint
}

// isVirtualHostStyle reports whether the given endpoint supports S3 virtual
// host style bucket name resolving. If a custom S3 API compatible endpoint is
// given, resolve the bucketname from the URL path.
func isVirtualHostStyle(endpoint urlpkg.URL) bool {
return endpoint == sentinelURL || supportsTransferAcceleration(endpoint) || IsGoogleEndpoint(endpoint)
return endpoint == sentinelURL || supportsTransferAcceleration(endpoint) || IsGoogleEndpoint(endpoint) || IsCoreWeaveEndpoint(endpoint)
}

func errHasCode(err error, code string) bool {
Expand Down
10 changes: 10 additions & 0 deletions storage/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ func TestNewSessionPathStyle(t *testing.T) {
endpoint: urlpkg.URL{Scheme: "https", Host: gcsEndpoint},
expectPathStyle: false,
},
{
name: "expect_virtual_host_style_for_coreweave_object_storage",
endpoint: urlpkg.URL{Scheme: "https", Host: cwObjectEndpoint},
expectPathStyle: false,
},
{
name: "expect_virtual_host_style_for_coreweave_object_storage_lota",
endpoint: urlpkg.URL{Scheme: "http", Host: cwLotaEndpoint},
expectPathStyle: false,
},
{
name: "expect_path_style_for_localhost",
endpoint: urlpkg.URL{Scheme: "http", Host: "127.0.0.1"},
Expand Down
Loading