Fix XML template xml:space injection for self-closing tags
The injectXmlSpacePreserve function was inserting the attribute AFTER the self-closing slash in tags like <t t-name="foo"/>, producing invalid XML: <t t-name="foo"/ xml:space="preserve"> Now correctly inserts before the slash: <t t-name="foo" xml:space="preserve"/> This fixes the "attributes construct error at column 33" that appeared as a red banner in the Odoo webclient list view. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
BIN
odoo-server
BIN
odoo-server
Binary file not shown.
@@ -317,6 +317,10 @@ func injectXmlSpacePreserve(s string) string {
|
||||
if idx < 0 {
|
||||
return s
|
||||
}
|
||||
// For self-closing tags like <t t-name="foo"/>, insert before the '/'
|
||||
if idx > 0 && s[idx-1] == '/' {
|
||||
return s[:idx-1] + ` xml:space="preserve"` + s[idx-1:]
|
||||
}
|
||||
return s[:idx] + ` xml:space="preserve"` + s[idx:]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user