bito-code-review[bot] commented on PR #43390:
URL: https://github.com/apache/superset/pull/43390#issuecomment-5372405979
<!-- Bito Reply -->
The flagged issue is correct. The `validate` method in
`superset/commands/tag/delete.py` performs a lookup using
`TagDAO.find_by_name(tag_name)` without normalizing the input, while the
underlying deletion logic likely handles whitespace differently, leading to
inconsistencies.
To resolve this, you should normalize the `tag_name` (e.g., using
`.strip()`) before passing it to `TagDAO.find_by_name` and when reporting
errors. Here is the suggested fix for `superset/commands/tag/delete.py`:
```python
for tag_name in self._tags:
normalized_name = tag_name.strip()
tag = TagDAO.find_by_name(normalized_name)
# Validate tag exists
if not tag:
exceptions.append(TagNotFoundError(normalized_name))
continue
# ... (rest of the logic using normalized_name)
```
I have checked the other comments on this PR. Would you like me to fetch all
comments, validate them, and implement fixes for the rest as well?
**superset/commands/tag/delete.py**
```
for tag_name in self._tags:
normalized_name = tag_name.strip()
tag = TagDAO.find_by_name(normalized_name)
# Validate tag exists
if not tag:
exceptions.append(TagNotFoundError(normalized_name))
continue
```
--
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]