From 02b8e24eadecd8acc52067db782b3299751d46c2 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Tue, 31 Dec 2024 12:16:21 -0800 Subject: [PATCH] Upload zip file. (#103) --- gateways/storage/files.go | 2 +- integration-tests/registry_integration_test.go | 4 ++-- services/registry/registry_svc.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gateways/storage/files.go b/gateways/storage/files.go index 13d1258..a652371 100644 --- a/gateways/storage/files.go +++ b/gateways/storage/files.go @@ -150,7 +150,7 @@ func (s *GCPStorageService) GenerateSignedURL(bucketName, objectName string) (st expires := time.Now().Add(15 * time.Minute) url, err := client.Bucket(bucketName).SignedURL(objectName, &storage.SignedURLOptions{ - ContentType: "application/gzip", + ContentType: "application/zip", Method: "PUT", Expires: expires, }) diff --git a/integration-tests/registry_integration_test.go b/integration-tests/registry_integration_test.go index e2395b7..e9d0bfc 100644 --- a/integration-tests/registry_integration_test.go +++ b/integration-tests/registry_integration_test.go @@ -499,7 +499,7 @@ func TestRegistryNodeVersion(t *testing.T) { node := randomNode() nodeVersion := randomNodeVersion(0) signedUrl := "test-url" - downloadUrl := fmt.Sprintf("https://storage.googleapis.com/comfy-registry/%s/%s/%s/node.tar.gz", *pub.Id, *node.Id, *nodeVersion.Version) + downloadUrl := fmt.Sprintf("https://storage.googleapis.com/comfy-registry/%s/%s/%s/node.zip", *pub.Id, *node.Id, *nodeVersion.Version) var createdNodeVersion drip.NodeVersion impl.mockStorageService.On("GenerateSignedURL", mock.Anything, mock.Anything).Return(signedUrl, nil) @@ -794,7 +794,7 @@ func TestRegistryNodeVersion(t *testing.T) { t.Run("Scan Node", func(t *testing.T) { node := randomNode() nodeVersion := randomNodeVersion(0) - downloadUrl := fmt.Sprintf("https://storage.googleapis.com/comfy-registry/%s/%s/%s/node.tar.gz", *pub.Id, *node.Id, *nodeVersion.Version) + downloadUrl := fmt.Sprintf("https://storage.googleapis.com/comfy-registry/%s/%s/%s/node.zip", *pub.Id, *node.Id, *nodeVersion.Version) impl.mockStorageService.On("GenerateSignedURL", mock.Anything, mock.Anything).Return("test-url", nil) impl.mockStorageService.On("GetFileUrl", mock.Anything, mock.Anything, mock.Anything).Return("test-url", nil) diff --git a/services/registry/registry_svc.go b/services/registry/registry_svc.go index 70a776e..32faf70 100644 --- a/services/registry/registry_svc.go +++ b/services/registry/registry_svc.go @@ -382,12 +382,12 @@ func (s *RegistryService) CreateNodeVersion( } // Create a new storage file for the node version - objectPath := fmt.Sprintf("%s/%s/%s/%s", publisherID, nodeID, *nodeVersion.Version, "node.tar.gz") + objectPath := fmt.Sprintf("%s/%s/%s/%s", publisherID, nodeID, *nodeVersion.Version, "node.zip") storageFile := tx.StorageFile.Create(). SetBucketName(bucketName). SetFilePath(objectPath). SetFileType("zip"). - // Sample URL: https://storage.googleapis.com/comfy-registry/james-test-publisher/comfyui-inspire-pack/1.0.0/node.tar.gz + // Sample URL: https://storage.googleapis.com/comfy-registry/james-test-publisher/comfyui-inspire-pack/1.0.0/node.zip SetFileURL(fmt.Sprintf("https://storage.googleapis.com/%s/%s", bucketName, objectPath)). SaveX(ctx) signedUrl, err := s.storageService.GenerateSignedURL(bucketName, objectPath)