U4-2109 - Regex text-field in DocTypes > (a type) > Properties (a property) > Validation + Description lack Trimming

Created by Chris McKee 12 Apr 2013, 14:10:49 Updated by Chris McKee 15 Apr 2013, 10:01:06


  • Create doc-type with a basic string property (add template etc)
  • Create page based on the above
  • Open doctypes and go to property -> validation (try pressing down cursor there will be two lines) ** Alternatively check the DB
  • Re-save the doc-type with this multi-blank-line; (note every time you open this page after saving and going back it adds another new lines)which makes me think that it may be in the HTML for the admin-frontend (loading in a newline each time then loading the saved new lines on top of this.
  • Attempt to go back to the page you created at the start and click save + publish; error thrown as in http://issues.umbraco.org/_persistent/Error%20On%20valid%20content%20due%20to%20regexing%20new%20line.JPG?file=64-689&v=1&c=true&rw=782&rh=164

Places this probably needs fixing

  • If it is in the html; obviously fix it here first.
  • On postback use string.trim to remove all extraneous crap; its a regex field there shouldn't be any need for surrounding WS.
  • Repeat fix for Description field on the same page.

Images included show steps taken and expectations.

5 Attachments

Download TestUmbracoBugU4-2109.7z


Sebastiaan Janssen 13 Apr 2013, 11:06:34

Thanks for the detailed report!

Unfortunately I cannot recreate this in a clean Umbraco 6.0.3 install. is there anything else you can think of the might interfere here? Installed packages? Browser differences?

I'll close this for now until we can get a repro of the issue.

Chris McKee 15 Apr 2013, 08:58:36

I've attached a sample solution + CE DB zipped up in 7-zip.

Basically the issue of adding the new-lines lies within Umbraco Components; the actual issue that occurs though is being caused by the lack of field sanitation in umbraco.

I can put whitespace and new-lines in, and only those as in no extra characters, in a regex field and umbraco fails to trim/clear them even though the whitespace wouldn't be valid within a regex statement.

This then leads to an unmeetable format requirement that is unlikely to have been created on purpose with no obvious means of remedy to a normal-user or (lets be honest) your core dev base.

Its a small thing to fix and as the attached shows is reproducible within an umbraco project with no other plugins.

Sebastiaan Janssen 15 Apr 2013, 09:39:42

I see, your initial report led me to believe that somehow whitespace was inserted automatically. I agree that the validation field should be trimmed. Fixed in changeset ff0ea16d7a2d

Chris McKee 15 Apr 2013, 10:01:06

Ta G. The field is growing but thats possibly coming from ucomponents (only plugin installed - via nuget). The fix solves the resulting issue rather than the cause for me but its a sensible precaution eitherway.

Priority: Normal

Type: Bug

State: Fixed


Difficulty: Easy


Backwards Compatible: True

Fix Submitted:

Affected versions: 6.0.3

Due in version: 6.0.4, 4.11.7


Story Points: