From fd7819d3424c8be65bd79ee3b9eff94969698bdb Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Wed, 20 Aug 2025 17:11:47 +0200 Subject: [PATCH] Also "wash" the `name` attribute of textarea and select --- program/lib/Roundcube/rcube_washtml.php | 2 +- tests/Framework/WashtmlTest.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php index f5545e29b..bb71a0b7f 100644 --- a/program/lib/Roundcube/rcube_washtml.php +++ b/program/lib/Roundcube/rcube_washtml.php @@ -326,7 +326,7 @@ class rcube_washtml $out = $value; } } elseif ($this->_css_prefix !== null - && (in_array($key, ['id', 'class', 'for']) || ($key == 'name' && in_array($node->nodeName, ['a', 'img', 'input', 'form']))) + && (in_array($key, ['id', 'class', 'for']) || ($key == 'name' && in_array($node->nodeName, ['a', 'img', 'input', 'form', 'select', 'textarea']))) ) { $out = preg_replace('/(\S+)/', $this->_css_prefix . '\1', $value); } elseif ($key == 'xmlns' && !strpos($value, '://')) { diff --git a/tests/Framework/WashtmlTest.php b/tests/Framework/WashtmlTest.php index 0e624fc92..d80ba9af7 100644 --- a/tests/Framework/WashtmlTest.php +++ b/tests/Framework/WashtmlTest.php @@ -721,7 +721,16 @@ class WashtmlTest extends TestCase $html = ''; $washed = $washer->wash($html); - $this->assertStringContainsString('name="testmyform"', $washed); + $this->assertStringNotContainsString('name="description"', $washed); + $this->assertStringContainsString('input name="testmyform"', $washed); + + $html = '