Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions util/minio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,21 @@ def get_presigned_url(self, mesh_id, expires=timedelta(hours=1)):
allowed_buckets = settings.MINIO_DATA.get("allowed_buckets")
if bucket_name in allowed_buckets:
object_name = parts[1]
return self.client.presigned_get_object(
url = self.client.presigned_get_object(
bucket_name, object_name, expires=expires
)
return url
else:
logger.error(f"Access to bucket {bucket_name} is not allowed.")
return None
except Exception as e:
logger.error(f"Failed to generate presigned URL for {mesh_id}: {str(e)}")
# Debug variables -> remove after
endpoint = settings.MINIO_DATA.get("endpoint")
parts = mesh_id.split("/", 1)
bucket_name = parts[0]
object_name = parts[1]
# end debug
logger.error(f"Failed to generate presigned URL for {mesh_id}: {str(e)}, endpoint: {endpoint}, bucket_name: {bucket_name}, object_name: {object_name}")
return None


Expand Down