Multi-org: format base path, not including protocol (#7260)

Remove hard-coded 'https://' when MULTI_ORG is enabled
This commit is contained in:
Eric Radman
2025-12-17 19:34:30 -05:00
committed by GitHub
parent bc68b1c38b
commit 262d46f465
2 changed files with 6 additions and 3 deletions

View File

@@ -211,7 +211,7 @@ def collect_parameters_from_request(args):
def base_url(org): def base_url(org):
if settings.MULTI_ORG: if settings.MULTI_ORG:
return "https://{}/{}".format(settings.HOST, org.slug) return "{}/{}".format(settings.HOST, org.slug)
return settings.HOST return settings.HOST

View File

@@ -1,6 +1,7 @@
import textwrap import textwrap
from unittest import TestCase from unittest import TestCase
from redash import settings
from redash.models import OPERATORS, Alert, db, next_state from redash.models import OPERATORS, Alert, db, next_state
from tests import BaseTestCase from tests import BaseTestCase
@@ -176,16 +177,18 @@ class TestAlertRenderTemplate(BaseTestCase):
ALERT_CONDITION equals ALERT_CONDITION equals
ALERT_THRESHOLD 5 ALERT_THRESHOLD 5
ALERT_NAME %s ALERT_NAME %s
ALERT_URL https:///default/alerts/%d ALERT_URL %s/default/alerts/%d
QUERY_NAME Query QUERY_NAME Query
QUERY_URL https:///default/queries/%d QUERY_URL %s/default/queries/%d
QUERY_RESULT_VALUE 1 QUERY_RESULT_VALUE 1
QUERY_RESULT_ROWS [{'foo': 1}] QUERY_RESULT_ROWS [{'foo': 1}]
QUERY_RESULT_COLS [{'name': 'foo', 'type': 'STRING'}] QUERY_RESULT_COLS [{'name': 'foo', 'type': 'STRING'}]
</pre> </pre>
""" % ( """ % (
alert.name, alert.name,
settings.HOST,
alert.id, alert.id,
settings.HOST,
alert.query_id, alert.query_id,
) )
result = alert.render_template(textwrap.dedent(custom_alert)) result = alert.render_template(textwrap.dedent(custom_alert))