Skip to content

Commit 715950c

Browse files
committed
[REM] website: test case for a form key ending with \
In that case Werkzeug 3.0.4 and later will drop the entire name (following pallets/werkzeug#2939, cf pallets/werkzeug#3032), we'll end up with a field named `None` on the python side, and then dispatching will blow up because `None` is not a valid kwarg. The exact semantics of that case are unclear (see also curl/curl#7789), my reading is that [RFC 7578][1] specifies percent-encoding and thus that should be used when encoding and decoding, and `\` should be irrelevant because it's neither `%` nor `"` so it's not a metacharacter for multipart/form-data headers. However the [whatwg living standard][2] rejects full blown percent-encoding, and instead uses percent-encoding on just a highly restricted set of inputs (which includes neither `\` nor `%`). And while it seems like we should be able to ignore RFC 6266 (the content-disposition header) who's to say that there are no real-world deployments which follow its strictures? Meh. [1]: https://datatracker.ietf.org/doc/html/rfc7578#section-2 [2]: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data Part-of: odoo#220858 Related: odoo/enterprise#91149 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
1 parent b950ed8 commit 715950c

2 files changed

Lines changed: 0 additions & 7 deletions

File tree

addons/website/static/tests/tours/website_form_editor.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,6 @@ registerWebsitePreviewTour(
11241124
run: "click",
11251125
},
11261126
...addCustomField("char", "text", `Test1"'`, false),
1127-
...addCustomField("char", "text", 'Test2`\\', false),
11281127
...clickOnSave(),
11291128
stepUtils.waitIframeIsReady(),
11301129
...essentialFieldsForDefaultFormFillInSteps,
@@ -1138,11 +1137,6 @@ registerWebsitePreviewTour(
11381137
trigger: `:iframe input[name="${CSS.escape("Test1&quot;'")}"]`,
11391138
run: "edit test1",
11401139
},
1141-
{
1142-
content: "Complete the second added field",
1143-
trigger: `:iframe input[name="${CSS.escape("Test2`\\")}"]`,
1144-
run: "edit test2",
1145-
},
11461140
{
11471141
content: "Click on 'Submit'",
11481142
trigger: ":iframe a.s_website_form_send",

addons/website/tests/test_website_form_editor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def test_website_form_special_characters(self):
6565
self.start_tour('/', 'website_form_special_characters', login='admin')
6666
mail = self.env['mail.mail'].search([], order='id desc', limit=1)
6767
self.assertIn('Test1&#34;&#39;', mail.body_html, 'The single quotes and double quotes characters should be visible on the received mail')
68-
self.assertIn('Test2`\\', mail.body_html, 'The backtick and backslash characters should be visible on the received mail')
6968

7069
def test_website_form_nested_forms(self):
7170
self.start_tour('/my/account', 'website_form_nested_forms', login='admin')

0 commit comments

Comments
 (0)