Page MenuHomePhabricator

Malformed input error on text which is not malformed
Closed, ResolvedPublic

Description

From time to time, I get the error Could not save due to an error. Malformed input: on text which does not appear to be malformed.

I found a way I can reliably reproduce it (Vivaldi/Linux):

Expected result: The statement is saved
Actual result: The error "Could not save due to an error. Malformed input: [ˈdʒɛndɐʃtɛrnçən]" is shown

If you make any changes to the text and undo them, then the value will suddenly be accepted, even though the text should be identical to the original value it tried to save, e.g. the following key sequences:

  • backspace ]
  • backspace ctrl-z
  • space backspace
  • . backspace
  • home delete [

Pressing keys which don't change the text content does not help, e.g. arrow keys, ctrl, shift, alt, tab shift-tab

I tried in Firefox as well. There, the text is copied with extra spaces (which have to be manually removed before it will be accepted), but if I copy the text in Vivaldi (or Iridium, another Chromium-based browser) and paste it into the field in Firefox, I get the same problem.

If I paste the text into a textarea (e.g. talk page) there is a new line at the end of what is pasted. It seems like the new line is being stripped when pasting, but it thinks it is still there until I make a change to the field which makes it realise it isn't.

(this does not seem to be the same as T250695 since that is about improving the error when there are actual space characters in the string which the user should remove - in cases like this one, the text in the field is already correct)

Event Timeline

I can reproduce it in Vivaldi in Windows too, so it doesn't seem to be Linux-specific either.

Addshore subscribed.

Reopening to investigate the specific issue around adding a space removing space and then the value being accepted (so that we can figure out what is happening there and figure out the right path in conjunction (maybe) with T47925: [Task] Apply normalization to string values in statements

FWIW reading this reminded me of AutoExpandInput which was, rather recently, re-implemented (originally for termbox) in vue as ResizingTextField.

Change 627554 had a related patch set uploaded (by Guergana Tzatchkova; owner: Guergana Tzatchkova):
[mediawiki/extensions/Wikibase@master] Fix Malformed input error

https://gerrit.wikimedia.org/r/627554

Change 627747 had a related patch set uploaded (by Guergana Tzatchkova; owner: Guergana Tzatchkova):
[data-values/value-view@master] Fix Malformed input error

https://gerrit.wikimedia.org/r/627747

Change 627554 abandoned by Guergana Tzatchkova:
[mediawiki/extensions/Wikibase@master] Fix Malformed input error

Reason:
pushed this in submodule

https://gerrit.wikimedia.org/r/627554

Note: the tests added to solve this bug are to be run locally with the grunt test --force command. They don't show up in Special:JavascriptTest

After discussion with @guergana.tzatchkova we decided I will inherit this task as she is moving on to a hike starting tomorrow.

Change 629376 had a related patch set uploaded (by Tobias Andersson; owner: Tobias Andersson):
[data-values/value-view@master] Sanitize input for StringValue on paste event

https://gerrit.wikimedia.org/r/629376

Change 629721 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Parse string values via PHP, not JS

https://gerrit.wikimedia.org/r/629721

Change 629376 abandoned by Tobias Andersson:
[data-values/value-view@master] Sanitize input for StringValue on paste event

Reason:

https://gerrit.wikimedia.org/r/629376

Change 629721 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Parse string values via PHP, not JS

https://gerrit.wikimedia.org/r/629721

Change 627747 merged by jenkins-bot:
[data-values/value-view@master] Fix malformed input error

https://gerrit.wikimedia.org/r/627747

Change 630424 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[data-values/value-view@master] Revert "Fix malformed input error"

https://gerrit.wikimedia.org/r/630424

Change 630424 merged by jenkins-bot:
[data-values/value-view@master] Revert "Fix malformed input error"

https://gerrit.wikimedia.org/r/630424