Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bart ten Velde 16 posts 278 karma points
    Jul 01, 2015 @ 08:45
    Bart ten Velde
    0

    Texbox multiple linebreaks change from \n to \r\n after republish

    Hi, the linebreaks change from \n to \r\n after republish entire site.

    Steps to reproduce in version 7.1.8 and 7.2.6:

    1. create a new document type named 'page' with matching template
    2. add a textbox multiple property to the 'page' document type named 'list'
    3. create a new page in the content tree fill in the 'list' property with 'one','two' and 'three' with a linebreak in between
    4. hit save and publish open the 'page' template change to

    Page template:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage 
    @{
    Layout = null;
    var list = Umbraco.Field("list").ToHtmlString();
    }
    @list
    

    After a save a publish the variable will contain= "one\ntwo\nthree" After a republish entire site the variable will contain= "one\r\ntwo\r\nthree"

    The convertLineBreaks option has no issue with this situation. But dependent code we use does a split using '\n' character to compare the values. After a republish this compare does not work anymore since the values are now "one\r", "two\r" and "three".

    The cache (umbraco.config) saves the value as

    <![CDATA[oneCRLF
    twoCRLF
    three]]>
    

    Anyone any clue? Meanwhile I'm looking at the Umbraco sources but I'm not familiar with the internals of content retrieval.

    Regards Bart

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Jul 01, 2015 @ 12:57
    Chriztian Steinmeier
    0

    I would be very curious to know how Umbraco actually does that "republish entire site", since any XML compliant tool should have normalized linebreaks to a single LF character before doing any further processing.

    Lurking here to be notified of any info you find...

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jul 02, 2015 @ 13:17
    Damiaan
    0

    Chriztian, you could have clicked the "follow" button ;-)

    (meanwhile I 'll be notified too :-D)

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Jul 02, 2015 @ 13:25
    Chriztian Steinmeier
    0

    Haha - Yes, I know :-)

    But I had to state my curiousness about the XML normalization too... :-)

  • Stephen 767 posts 2273 karma points c-trib
    Jul 02, 2015 @ 15:13
    Stephen
    0

    If by "republish all" you mean the "content" node right-click menu, then what happens is, the entire in-memory xml cache (the one that is saved in umbraco.config) is rebuilt from scratch by re-loading each node's xml fragment from the cmsContentXml table.

    Whereas during the initial "save & publish", that xml fragment is generated locally and then it is inserted into the main xml cache document.

    I'd need to look into the actual code, but what most probably happens is that the back-office editor returns "foo\nbar" as a value (would make sense for JavaScript) which is used as-is when creating the local xml cache, but somehow when that xml fragment is saved to cmsContentXml or when we read it back, the value is normalized to "foo\r\nbar".

    Can you file an issue?

  • Bart ten Velde 16 posts 278 karma points
    Jul 02, 2015 @ 15:19
    Bart ten Velde
    0

    Hi Stephan, I was indeed writing about the right click on 'content' and click on 'Republish entire site'.

    I will create an issue for this. Tnx for the feedback

    Bart

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Jul 02, 2015 @ 19:47
    Chriztian Steinmeier
    0

    I'd look for anywhere the XML is handled as "plain text" instead of XML - would be a prime suspect :)

  • Bart ten Velde 16 posts 278 karma points
    Jul 02, 2015 @ 15:24
    Bart ten Velde
    0

    Issue U4-6785 is created for this issue http://issues.umbraco.org/issue/U4-6785

  • Stephen 767 posts 2273 karma points c-trib
    Jul 06, 2015 @ 13:36
    Stephen
    100

    Confirmed (see issue tracker) and fixed.

  • Bart ten Velde 16 posts 278 karma points
    Jul 06, 2015 @ 13:38
    Bart ten Velde
    0

    Thank you very much !!

Please Sign in or register to post replies

Write your reply to:

Draft