fix(portal): guard sidebar item dict access with .get() fallbacks
Direct entry['url'] / entry['label'] would 500 the portal page if a
future helper emits an item dict missing a key. Use .get('url', '#')
and .get('label', '') so a malformed entry degrades silently instead
of taking the page down. Helper data is currently trusted (defined
in _FP_SIDEBAR_LAYOUT class constant) but defensive iteration is
cheap and prevents regression bugs from cascading.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -81,14 +81,14 @@
|
||||
<t t-foreach="fp_sidebar_items or []" t-as="entry">
|
||||
<!-- Section labels render as non-link headers -->
|
||||
<t t-if="entry.get('type') == 'section_label'">
|
||||
<div class="o_fp_sidebar_section_label" t-out="entry['label']"/>
|
||||
<div class="o_fp_sidebar_section_label" t-out="entry.get('label', '')"/>
|
||||
</t>
|
||||
<!-- Items render as anchor links -->
|
||||
<t t-elif="entry.get('type') == 'item'">
|
||||
<a t-att-href="entry['url']"
|
||||
<a t-att-href="entry.get('url', '#')"
|
||||
t-attf-class="o_fp_sidebar_item #{'o_fp_sidebar_active' if entry.get('active') else ''}">
|
||||
<span class="o_fp_sidebar_icon" t-out="entry.get('icon') or '•'"/>
|
||||
<span t-out="entry['label']"/>
|
||||
<span t-out="entry.get('label', '')"/>
|
||||
</a>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user