From 5d6400eec0692ba798ec42c0a6fec06253fb2a3d Mon Sep 17 00:00:00 2001 From: RhodeCode Admin Date: Tue, 27 Feb 2024 09:52:29 +0100 Subject: [PATCH] fix(service-api): rely on urljoin for constructing the call url --- rhodecode/lib/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py index 1f8c383f..01902210 100644 --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -21,6 +21,7 @@ Utilities library for RhodeCode """ import datetime + import decorator import logging import os @@ -31,6 +32,7 @@ import socket import tempfile import traceback import tarfile +import urllib.parse import warnings from functools import wraps from os.path import join as jn @@ -849,7 +851,7 @@ def call_service_api(ini_path, payload): 'auth_token': config.get('app:main', 'app.service_api.token') }) - response = CurlSession().post(f'{host}{api_url}', json.dumps(payload)) + response = CurlSession().post(urllib.parse.urljoin(host, api_url), json.dumps(payload)) if response.status_code != 200: raise Exception("Service API responded with error")