EOX GitLab Instance

Commit fd5fe011 authored by Fabian Schindler's avatar Fabian Schindler
Browse files

registrar: Fixing url null issue in storage when no bucket name is specified

parent 5277dedb
......@@ -10,6 +10,7 @@ import sys
import logging
from typing import List, TYPE_CHECKING, TypedDict
import json
from urllib.parse import urlparse
import django
from django.db import transaction
......@@ -106,6 +107,7 @@ class EOxServerBackend(Backend):
created_storage_auth = False
created_storage = False
storage_name = None
if isinstance(source, LocalSource):
storage, created_storage = backends.Storage.get_or_create(
......@@ -128,6 +130,13 @@ class EOxServerBackend(Backend):
endpoint_url = endpoint_url[len('http://'):]
bucket = source.bucket_name
# get default bucket name from "first" asset. The first path
# component is the bucket.
if bucket is None:
asset = next(iter(item.get_assets().values()), None)
bucket = urlparse(asset.href).path.partition('/')[0]
storage_auth, created_storage_auth = \
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment