AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(autogpt): Fix GCS and S3 root path issue (#7010)
Krzysztof Czerwinskicb1297ec743f
diff --git a/autogpts/autogpt/autogpt/file_storage/gcs.py b/autogpts/autogpt/autogpt/file_storage/gcs.pyindex 41319ac719..0d6cbc4f2a 100644--- a/autogpts/autogpt/autogpt/file_storage/gcs.py+++ b/autogpts/autogpt/autogpt/file_storage/gcs.py@@ -33,7 +33,9 @@ class GCSFileStorage(FileStorage):def __init__(self, config: GCSFileStorageConfiguration):self._bucket_name = config.bucketself._root = config.root- assert self._root.is_absolute()+ # Add / at the beginning of the root path+ if not self._root.is_absolute():+ self._root = Path("/").joinpath(self._root)self._gcs = storage.Client()super().__init__()diff --git a/autogpts/autogpt/autogpt/file_storage/s3.py b/autogpts/autogpt/autogpt/file_storage/s3.pyindex eb47abe612..5d4bf8dc5b 100644--- a/autogpts/autogpt/autogpt/file_storage/s3.py+++ b/autogpts/autogpt/autogpt/file_storage/s3.py@@ -42,7 +42,9 @@ class S3FileStorage(FileStorage):def __init__(self, config: S3FileStorageConfiguration):self._bucket_name = config.bucketself._root = config.root- assert self._root.is_absolute()+ # Add / at the beginning of the root path+ if not self._root.is_absolute():+ self._root = Path("/").joinpath(self._root)# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.htmlself._s3 = boto3.resource(