bito-code-review[bot] commented on code in PR #44549:
URL: https://github.com/apache/superset/pull/44549#discussion_r4078038604
##########
superset/models/slice.py:
##########
@@ -449,7 +464,7 @@ def slice_link(self) -> Markup:
# SCRIPT_NAME (the application_root). `Slice.url` itself stays router-
# relative so frontend callers can apply ensureAppRoot exactly once.
href = url_for("ExploreView.root", slice_id=self.id)
- return Markup(f'<a href="{href}">{name}</a>')
+ return Markup('<a href="{}">{}</a>').format(href, name)
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>IndexError in slice_link format</b></div>
<div id="fix">
`Markup('<a href="{}{}">{}</a>').format(href, name)` has 3 placeholders but
only 2 args, so every access of `slice_link` raises `IndexError: tuple index
out of range` (confirmed: `Markup(...).format('http://x','name')` fails). The
prior f-string had 2 placeholders. This crashes the FAB chart list view that
renders this raw HTML. Fix: `Markup('<a href="{}">{}</a>').format(href, name)`.
</div>
</div>
<small><i>Code Review Run #1c1531</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]