Copied to clipboard

Flag this post as spam?

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


  • Lucas Chasteen 24 posts 92 karma points
    May 22, 2014 @ 23:49
    Lucas Chasteen
    1

    UmbracoHelper Truncate not ignoring tags properly?

    Maybe my expectations are incorrect, but when I figured the treatTagsAsContent=false will parse text but ignore the surrounding HTML, I was getting weird results so I started digging in:

    I was working on a template that uses @Umbraco.Truncate on an RTE property and it appears that this method is incorrectly counting both the end '>' on tags as well as any attributes within the tag (ie class).

    Poking through the 7.1.3 source I did get the expected behavior by commenting out the following lines in Umbraco.Web.UmbracoHelper.cs:

    1182 to fix the end tag issue (<p>Lorem... would truncate to one less char than asked for)

    1221 to fix the issue I was seeing with classes (<p><span class="a">Lorem.... would truncate to empty)

    I didn't really step through the code to see why it's freaking out for me with classes, so I'm sure there's a better fix.

     

  • Moran 285 posts 934 karma points
    Jun 14, 2014 @ 09:39
    Moran
    0

    I am having the same issue.

    Thanks for posting

Please Sign in or register to post replies

Write your reply to:

Draft