Skip to content

Commit

Permalink
remove use_access_for_presign as doesn't make sense anymore
Browse files Browse the repository at this point in the history
always using presign_endpoint_url, defaulting to endpoint_url for presigning
  • Loading branch information
ikreymer committed Dec 17, 2024
1 parent 3914e70 commit fb17c83
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
1 change: 0 additions & 1 deletion backend/btrixcloud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,6 @@ class S3Storage(BaseModel):
access_endpoint_url: str
presign_endpoint_url: str = Field(default_factory=lambda data: data["endpoint_url"]) # type: ignore
region: str = ""
use_access_for_presign: bool = True


# ============================================================================
Expand Down
9 changes: 1 addition & 8 deletions backend/btrixcloud/storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,8 @@ def _create_s3_storage(self, storage: dict[str, str]) -> S3Storage:

if self.is_local_minio:
access_endpoint_url = "/data/"
use_access_for_presign = False
else:
access_endpoint_url = storage.get("access_endpoint_url") or endpoint_url
use_access_for_presign = is_bool(storage.get("use_access_for_presign"))
presign_endpoint_url = storage.get("presign_endpoint_url") or endpoint_url

return S3Storage(
Expand All @@ -154,7 +152,6 @@ def _create_s3_storage(self, storage: dict[str, str]) -> S3Storage:
endpoint_url=endpoint_url,
endpoint_no_bucket_url=endpoint_no_bucket_url,
access_endpoint_url=access_endpoint_url,
use_access_for_presign=use_access_for_presign,
presign_endpoint_url=presign_endpoint_url,
)

Expand All @@ -181,7 +178,6 @@ async def add_custom_storage(
endpoint_no_bucket_url=endpoint_no_bucket_url,
access_endpoint_url=storagein.access_endpoint_url or storagein.endpoint_url,
presign_endpoint_url=storagein.endpoint_url,
use_access_for_presign=True,
)

try:
Expand Down Expand Up @@ -273,8 +269,6 @@ async def get_s3_client(
"""context manager for s3 client"""
if use_presign_url:
endpoint_url = storage.presign_endpoint_url
elif storage.use_access_for_presign:
endpoint_url = storage.access_endpoint_url
else:
endpoint_url = storage.endpoint_url

Expand Down Expand Up @@ -477,8 +471,7 @@ async def get_presigned_url(
)

if (
not s3storage.use_access_for_presign
and s3storage.access_endpoint_url
s3storage.access_endpoint_url
and s3storage.access_endpoint_url != s3storage.presign_endpoint_url
):
presigned_url = presigned_url.replace(
Expand Down

0 comments on commit fb17c83

Please sign in to comment.