Copied to clipboard

Flag this post as spam?

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


  • Chris Smith 39 posts 142 karma points
    Jun 06, 2016 @ 15:48
    Chris Smith
    0

    {localLink:xxx} isn't encoding properly

    Hi.

    We've noticed a problem with local links on two of our 7.4.3 sites. Basically we've found the "{" and "}" are rendering out as %7B and %7D when you go to click on the link so the link fails with a

    A potentially dangerous Request.Path value was detected from the client (:).

    error when the user clicks it.

    The html in the browser's view source and the Umbraco RTE shows

    <a data-id="12132" href="/{localLink:12132}" title="Staff support">For a full list of other sessions click here.</a>
    

    however, in Chrome and IE when you mouse over or click on the link it renders http://intranet.local/%7BlocalLink:12132%7D

    This has happened on 2 separate 7.4.3 sites which have been built in isolation although they do share a few common packages and a custom AD login for the back office we've built in-house.

    We've only noticed this as an issue in the last week or so and these packages have been installed since the sites were first set up a couple of months ago so I don't think they're the cause.

    Any suggestions on what might be causing this would be greatly appreciated.

    Cheers

    Chris

  • Matt Geal 4 posts 74 karma points
    Aug 31, 2016 @ 16:31
    Matt Geal
    0

    I'm also getting this problem with links added to content pages from within the rich text editor. The URL is generating as: /%7BlocalLink:1949%7D

    Any ideas?

  • Matt Geal 4 posts 74 karma points
    Sep 02, 2016 @ 13:22
    Matt Geal
    0

    I managed to fix this myself. Because my rich text editor was within a custom grid editor that I wrote, I had to wrap my rich text editor content inside TemplateUtilities.ParseInternalLinks() before rendering it.

  • Ben 112 posts 398 karma points
    Jul 11, 2017 @ 19:48
    Ben
    0

    I am having the same problem in 7.6.2 on a test site. My live site is on 7.5.6 and I am able to use {localLink:####} in the html code on the templates. Is there a different way to get a link to a specific content page or should I be using the url for the page?

  • Ben 112 posts 398 karma points
    Jul 11, 2017 @ 20:18
    Ben
    0

    I found a way to link to the specific content page. In the template do the following:

    @{
       UmbracoHelper umHelper = new UmbracoHelper(UmbracoContext.Current);
     }
    <p><a href="@umHelper.TypedContent("20d38e38-12bf-433a-9bbe-9934d7af459d").Url">Acceptable Use Policy</a></p>
    <p><a href="@umHelper.TypedContent("5871dd6e-bb75-4d14-8e38-3fbf97b857b6").Url">Disclaimer</a></p>
    
  • Thomas 6 posts 87 karma points c-trib
    Feb 11, 2020 @ 09:30
    Thomas
    0

    I have had a similar issue and would like to share my solution:

    I am doing this in a Macro Partial View, the content is HTML code coming from a RTE.

    First you need to decode the HTML:

    string html = HttpUtility.HtmlDecode(content);
    

    Then you can parse the links with the ParseInernalLinks function:

    html = TemplateUtilities.ParseInternalLinks(html, UmbracoContext.Current.UrlProvider);
    

    Eventually you can display in your view:

    <div class="card-body">@Html.Raw(html)</div>
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies