π OpenHands: AI-Driven Development
Fix google cloud session manager (#3942)
tofarr31dbd3d02ed1
diff --git a/openhands/storage/__init__.py b/openhands/storage/__init__.pyindex f9c91fa558..98ab31aa52 100644--- a/openhands/storage/__init__.py+++ b/openhands/storage/__init__.py@@ -13,5 +13,5 @@ def get_file_store(file_store: str, file_store_path: str | None = None) -> FileSelif file_store == 's3':return S3FileStore()elif file_store == 'google_cloud':- return GoogleCloudFileStore()+ return GoogleCloudFileStore(file_store_path)return InMemoryFileStore()diff --git a/openhands/storage/google_cloud.py b/openhands/storage/google_cloud.pyindex 00177ba82c..bbd2da2730 100644--- a/openhands/storage/google_cloud.py+++ b/openhands/storage/google_cloud.py@@ -1,6 +1,7 @@import osfrom typing import List, Optional+from google.api_core.exceptions import NotFoundfrom google.cloud import storagefrom openhands.storage.files import FileStore@@ -25,8 +26,11 @@ class GoogleCloudFileStore(FileStore):def read(self, path: str) -> str:blob = self.bucket.blob(path)- with blob.open('r') as f:- return f.read()+ try:+ with blob.open('r') as f:+ return f.read()+ except NotFound as err:+ raise FileNotFoundError(err)def list(self, path: str) -> List[str]:if not path or path == '/':