Page MenuHomePhabricator

Trim text input before saving on Structured Data on Commons string input
Open, Needs TriagePublic

Assigned To
None
Authored By
Raymond
Apr 29 2020, 9:37 AM
Referenced Files
F36969418: whitespace.png
Apr 29 2023, 2:04 PM
F35020195: Screenshot from 2022-03-22 18-30-15.png
Mar 22 2022, 5:30 PM
F31786421: grafik.png
Apr 29 2020, 9:37 AM
Tokens
"Like" token, awarded by Salgo60.

Description

Trim text input before saving

Steps to reproduce:

  1. Copy a text with leading and/or trailing space(s) into a string-based statement (see screenshot)
  2. Paste it in a text field, like "name"
  3. Useless error appears

In this example a leading space in front of "Swiss Ruby"

grafik.png (501×804 px, 16 KB)

Possible solution:

  • use the parse API for strings in the UI

Event Timeline

Yes, ran into this too on Wikidata this week. The stripping could happen on the front end javascript or in the backend API. Not sure where other clean up is currently happening. AFAIK this only applies to string datatypes so I'll update the task a bit.

Multichill renamed this task from Trim text input before saving to Trim text input before saving on Wikibase string input.May 2 2020, 11:01 AM
Multichill updated the task description. (Show Details)

Any chance that this could be fixed in the near future? It's really annoying to run into the misleading error "wrong input". As I am an experienced user I know what to do (trim by hand) but other people with less experience would give up :-(

Putting it on my list to discuss with Adam next week.

Open question from my side: how do we deal with statements where the value is supposed to be only a whitespace? (I'm thinking of the Item for the whitespace character for example.)

Putting it on my list to discuss with Adam next week.

Open question from my side: how do we deal with statements where the value is supposed to be only a whitespace? (I'm thinking of the Item for the whitespace character for example.)

Those can't be added right now, so nothing would change there. For items about characters, I would suggest always using the P4213 (Unicode code point) value instead (especially if you're using SPARQL - T233204).

Isn't this ticket for Commons though, not Wikidata? There's already T47925 and T250695 for Wikidata, although it seems to be working fine for me there, e.g. I can no longer reproduce T261071.

Hi @Lucas_Werkmeister_WMDE, we now have built in Unicode normalization of string values already, right? So if we solved this task, it would automatically solve T47925 and others. In your opinion, could we just enable automated trimming in the parser? The case would be that we do not allow purely whitespace values in the UI, as I see no reason not move away from the working status quo. This seems like an obvious thing that we should do, but maybe I have missed something,

But still not the desktop UI of Structured Data on Commons :-( Tested a second ago.

Hm, looks like SDC doesn’t use the parse API, at least not for strings.

Screenshot from 2022-03-22 18-30-15.png (415×1 px, 44 KB)

Manuel renamed this task from Trim text input before saving on Wikibase string input to Trim text input before saving on Structured Data on Commons string input.Mar 23 2022, 2:17 PM
Manuel removed a project: Wikidata.
Manuel updated the task description. (Show Details)

Thank you! I have made the ticket more specific to SDC now, as this seems solved already for Wikibase.

Came here to report this useless message only to find out the problem was already reported 3 years ago...

whitespace.png (677×1 px, 34 KB)

What's the point in showing me the "bad" input when the whitespace that's not allowed will never be visible? And what's the point in showing me this error message instead of just trimming the whitespace like any normal form would?

All it has done is discourage me from editing SDC: I didn't want to start again, so I didn't add the statement and I'm not going to do the other statements I was planning to add either.