fix(autogpt): Fix GCS and S3 root path issue (#7010)

Fix root path issue
pull/7013/head
Krzysztof Czerwinski 2024-03-12 17:34:12 +01:00 committed by GitHub
parent 37904a0f80
commit cb1297ec74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -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__()

View File

@ -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(