bito-code-review[bot] commented on PR #44043:
URL: https://github.com/apache/superset/pull/44043#issuecomment-5595563546
<!-- Bito Reply -->
The flagged issue is correct. In
`superset/commands/dashboard/filter_state/get.py`, the
`native_filter_configuration` is retrieved from
`metadata.get("native_filter_configuration", [])`. If this key is missing or
null in the JSON metadata, `metadata.get` returns `[]` (the default), which is
safe. However, if the metadata itself is malformed or if the logic expects a
list but receives `None` (depending on how `metadata` is populated), iterating
over it can raise a `TypeError`.
To resolve this, ensure `native_filters` is explicitly handled as a list
even if the configuration is missing or null:
```python
native_filters = metadata.get("native_filter_configuration")
if not isinstance(native_filters, list):
native_filters = []
```
This ensures that `native_filters` is always a list, preventing `TypeError`
during iteration. Would you like me to fetch all other comments on this PR to
validate and implement fixes for them as well?
**superset/commands/dashboard/filter_state/get.py**
```
native_filters = metadata.get("native_filter_configuration")
if not isinstance(native_filters, list):
native_filters = []
```
--
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]