Skip to content

Commit 73038f3

Browse files
fix api base url creator
1 parent 74884a7 commit 73038f3

File tree

1 file changed

+8
-1
lines changed
  • services/director-v2/src/simcore_service_director_v2/modules/osparc_variables

1 file changed

+8
-1
lines changed

services/director-v2/src/simcore_service_director_v2/modules/osparc_variables/substitutions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
from copy import deepcopy
66
from typing import Any, Final, TypeVar
7+
from urllib.parse import urlparse, urlunparse
78

89
from fastapi import FastAPI
910
from models_library.osparc_variable_identifier import (
@@ -42,7 +43,13 @@
4243

4344

4445
def _make_api_server_base_url(base_url: str):
45-
return f"api.{base_url}"
46+
parsed = urlparse(base_url)
47+
hostname = parsed.hostname or ""
48+
49+
if not hostname.startswith("api."):
50+
hostname = f"api.{hostname}"
51+
52+
return urlunparse((parsed.scheme, hostname, "", "", "", ""))
4653

4754

4855
async def substitute_vendor_secrets_in_model(

0 commit comments

Comments
 (0)