Skip to content

Commit 262d46f

Browse files
authored
Multi-org: format base path, not including protocol (#7260)
Remove hard-coded 'https://' when MULTI_ORG is enabled
1 parent bc68b1c commit 262d46f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

redash/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def collect_parameters_from_request(args):
211211

212212
def base_url(org):
213213
if settings.MULTI_ORG:
214-
return "https://{}/{}".format(settings.HOST, org.slug)
214+
return "{}/{}".format(settings.HOST, org.slug)
215215

216216
return settings.HOST
217217

tests/models/test_alerts.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import textwrap
22
from unittest import TestCase
33

4+
from redash import settings
45
from redash.models import OPERATORS, Alert, db, next_state
56
from tests import BaseTestCase
67

@@ -176,16 +177,18 @@ def test_render_custom_alert_template(self):
176177
ALERT_CONDITION equals
177178
ALERT_THRESHOLD 5
178179
ALERT_NAME %s
179-
ALERT_URL https:///default/alerts/%d
180+
ALERT_URL %s/default/alerts/%d
180181
QUERY_NAME Query
181-
QUERY_URL https:///default/queries/%d
182+
QUERY_URL %s/default/queries/%d
182183
QUERY_RESULT_VALUE 1
183184
QUERY_RESULT_ROWS [{'foo': 1}]
184185
QUERY_RESULT_COLS [{'name': 'foo', 'type': 'STRING'}]
185186
</pre>
186187
""" % (
187188
alert.name,
189+
settings.HOST,
188190
alert.id,
191+
settings.HOST,
189192
alert.query_id,
190193
)
191194
result = alert.render_template(textwrap.dedent(custom_alert))

0 commit comments

Comments
 (0)