sadpandajoe commented on code in PR #43885:
URL: https://github.com/apache/superset/pull/43885#discussion_r4049278239
##########
superset/models/slice.py:
##########
@@ -442,7 +442,26 @@ def set_related_perm(_mapper: Mapper, _connection:
Connection, target: Slice) ->
# pylint: disable=import-outside-toplevel
from superset.daos.datasource import DatasourceDAO
- src_class = DatasourceDAO.sources[target.datasource_type]
+ src_class = DatasourceDAO.sources.get(target.datasource_type)
Review Comment:
An editor can now save `PUT /api/v1/chart/<id>` with `{"datasource_type":
null}`: the schema allows null, `UpdateChartCommand` skips its truthy-only type
check, and this guard lets the flush commit instead of rolling back, leaving
the existing chart without a resolvable datasource. Could we reject an
explicitly null type at the update boundary and add a regression proving the
chart's datasource and permissions remain unchanged?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]