1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Use endpoint_url in S3Backend

This commit is contained in:
Javier de la Puente
2024-04-17 09:44:19 +02:00
committed by Jeremy Stretch
parent 4284028bb0
commit c5ae89ad03

View File

@ -149,7 +149,8 @@ class S3Backend(DataBackend):
region_name=self._region_name,
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
config=self.config
config=self.config,
endpoint_url=self._endpoint_url
)
bucket = s3.Bucket(self._bucket_name)
@ -176,6 +177,11 @@ class S3Backend(DataBackend):
url_path = urlparse(self.url).path.lstrip('/')
return url_path.split('/')[0]
@property
def _endpoint_url(self):
url_path = urlparse(self.url)
return url_path._replace(params="", fragment="", query="", path="").geturl()
@property
def _remote_path(self):
url_path = urlparse(self.url).path.lstrip('/')