gcs tests pass, updated get_file and delete_file to retrieve blob instead of instantiating blob

This commit is contained in:
kahghi committed 2025-01-21 12:53:49 +08:00
1 parent 4b56c15a3f
commit 55cc127b03
2 files changed
+47 -57

No files matched your search

+2 -2
View File
@@ -168,7 +168,7 @@ class GCSStorageProvider(StorageProvider):
try:
filename = file_path.removeprefix("gs://").split("/")[1]
local_file_path = f"{UPLOAD_DIR}/{filename}"
blob = self.bucket.blob(filename)
blob = self.bucket.get_blob(filename)
blob.download_to_filename(local_file_path)
return local_file_path
@@ -179,7 +179,7 @@ class GCSStorageProvider(StorageProvider):
"""Handles deletion of the file from GCS storage."""
try:
filename = file_path.removeprefix("gs://").split("/")[1]
blob = self.bucket.blob(filename)
blob = self.bucket.get_blob(filename)
blob.delete()
except NotFound as e:
raise RuntimeError(f"Error deleting file from GCS: {e}")