diff --git a/storage/s3.go b/storage/s3.go index 3313be66e..013bf299f 100644 --- a/storage/s3.go +++ b/storage/s3.go @@ -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" ) @@ -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 { diff --git a/storage/s3_test.go b/storage/s3_test.go index 11b52ebc3..767aec073 100644 --- a/storage/s3_test.go +++ b/storage/s3_test.go @@ -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"},