mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix(AlertsReports): validate anchor_list is a list (#38723)
This commit is contained in:
committed by
GitHub
parent
c96c817ef5
commit
100ad7d9ee
@@ -268,7 +268,11 @@ class BaseReportState:
|
||||
native_filter_params = self._report_schedule.get_native_filters_params()
|
||||
if anchor := dashboard_state.get("anchor"):
|
||||
try:
|
||||
anchor_list: list[str] = json.loads(anchor)
|
||||
anchor_list = json.loads(anchor)
|
||||
if not isinstance(anchor_list, list):
|
||||
raise json.JSONDecodeError(
|
||||
"Anchor value is not a list", anchor, 0
|
||||
)
|
||||
urls = self._get_tabs_urls(
|
||||
anchor_list,
|
||||
native_filter_params=native_filter_params,
|
||||
|
||||
@@ -259,6 +259,12 @@ def test_log_data_with_missing_values(mocker: MockerFixture) -> None:
|
||||
["url1"],
|
||||
["superset/dashboard/p/url1/"],
|
||||
),
|
||||
# Test JSON scalar string anchor falls back to single tab
|
||||
(
|
||||
json.dumps("mock_tab_anchor_1"),
|
||||
["url1"],
|
||||
["superset/dashboard/p/url1/"],
|
||||
),
|
||||
],
|
||||
)
|
||||
@patch(
|
||||
|
||||
Reference in New Issue
Block a user