aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Krzysztof Czerwinski <34861343+kcze@users.noreply.github.com> 2024-03-12 17:34:12 +0100
committerGravatar GitHub <noreply@github.com> 2024-03-12 17:34:12 +0100
commitcb1297ec743f1053ae0fbb57205c62cae1b11866 (patch)
treeb4a30db5b8e4cb4617bbd315656da9a6398f811e
parentfeat(agent): Fully abstracted file storage access with `FileStorage` (#6931) (diff)
downloadAuto-GPT-cb1297ec743f1053ae0fbb57205c62cae1b11866.tar.gz
Auto-GPT-cb1297ec743f1053ae0fbb57205c62cae1b11866.tar.bz2
Auto-GPT-cb1297ec743f1053ae0fbb57205c62cae1b11866.zip
fix(autogpt): Fix GCS and S3 root path issue (#7010)
Fix root path issue
-rw-r--r--autogpts/autogpt/autogpt/file_storage/gcs.py4
-rw-r--r--autogpts/autogpt/autogpt/file_storage/s3.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/autogpts/autogpt/autogpt/file_storage/gcs.py b/autogpts/autogpt/autogpt/file_storage/gcs.py
index 41319ac71..0d6cbc4f2 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.bucket
self._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.py
index eb47abe61..5d4bf8dc5 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.bucket
self._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.html
self._s3 = boto3.resource(