Needs work
Project:
Drupal Canvas
Version:
1.x-dev
Component:
AI
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Apr 2026 at 19:58 UTC
Updated:
5 May 2026 at 09:11 UTC
Jump to comment: Most recent
Comments
Comment #4
shubham.prakash commentedComment #5
shubham.prakash commentedAI Assisted Code:
Summary:
Root cause: LLMs sometimes HTML-encode characters in generated code (e.g., > → >, < → <, & → &). The CreateComponent and EditComponentJs function call plugins were using the raw LLM output for js_structure/css_structure/javascript without decoding these entities, so the escaped code was stored directly in the component.
Fix: Added html_entity_decode(..., ENT_QUOTES | ENT_HTML5) when reading the code context values in both plugins — matching the pattern already used in GetPropsType.php for derived_proptypes. ENT_QUOTES | ENT_HTML5 ensures all HTML5 named entities and both single/double quotes are decoded.
Comment #6
narendrarLooks good. Could we add some test coverage in
EditComponentJsTestandCreateComponentTestas well?