x First time here? Check out the FAQ

Come work for Umbraco - The Umbraco HQ are hiring Project managers, .NET developers and DevOps people!

  • Avatar1138posts2261karma

    Apostrophe in page name breaks insert link dialogue

    dandrayne started this topic January 20, 2011 @ 02:04, Go directly to the topic solution

    Hi All

    This is just a quick note to ask that http://umbraco.codeplex.com/workitem/29080?ProjectName=umbraco be reopened (and fixed, hopefully).  As it has been an ongoing issue for quite some time, and is still a problem in 4.6.1 as far as I can tell.

    As our client in this case is a School, resorting to poor grammar to work around the issue isn't an option ;-)

    Dan


  • Avatar2003posts4176karma
    CoreComment with ID: 61522
    Tom Fulton posted this reply January 20, 2011 @ 02:44

    Hi Dan,

    Did you try the latest build?  I saw a new bug report was opened up after this one was closed, and it appears to have been fixed/closed yesterday.  I did not have a chance to test it yet though.

    http://umbraco.codeplex.com/workitem/29904

    -Tom


  • Avatar1138posts2261karma
    Comment with ID: 61523
    dandrayne posted this reply January 20, 2011 @ 02:49

    Hi Tom

    Thanks for that - I didn't see that report as I was searching on "apostrophe" in codeplex.

    I'm trying the latest stable release (4.6.1) - I'm not keen on upgrading live, heavily trafficed site to anything other than a stable release.

    I also don't have a masive amount of confidence in that comment as the same user posted almost exactly the same comment (Seems to be fixed in the current changeset) on Dec 20th on workitem 29904, then 3 weeks later the fix doesn't appear in the latest full release.

    Has anyone tried the latest changeset in production?

    Dan


  • Doug Mackay posted this reply January 22, 2011 @ 03:27

    It still looks to be an issue in the latest changeset.

    The issue is in umbraco\presentation\umbraco\Trees\BaseContentTree.cs - SetActionAttribute Method (Line 207) :-

    protected void SetActionAttribute(ref XmlTreeNode treeElement, Document dd)
    {
    ...
     else if (this.DialogMode == TreeDialogModes.locallink)
        {
         string nodeLink = string.Format("{{localLink:{0}}}", dd.Id);
         // try to make a niceurl too
         string niceUrl = umbraco.library.NiceUrl(dd.Id);
         if (niceUrl != "#" || niceUrl != "") {
          nodeLink += "|" + niceUrl + "|" + HttpContext.Current.Server.HtmlEncode(dd.Text);
         } else {
          nodeLink += "||" + HttpContext.Current.Server.HtmlEncode(dd.Text);
         }
        
         treeElement.Action = String.Format("javascript:openContent('{0}');", nodeLink.Replace("'","\\'"));
        }

    The last line is escaping the single quote but the link text has already been HtmlEncoded so all single quotes have been encoded as '

    I've tried the following which seems to work :-

    else if (this.DialogMode == TreeDialogModes.locallink)
    {
      string nodeLink = string.Format("{{localLink:{0}}}", dd.Id);
      string nodeText = dd.Text.Replace("'", "\\'");
      // try to make a niceurl too
      string niceUrl = umbraco.library.NiceUrl(dd.Id).Replace("'", "\\'");
      if (niceUrl != "#" || niceUrl != "")
      {
       nodeLink += "|" + niceUrl + "|" + HttpContext.Current.Server.HtmlEncode(nodeText);
      }
      else
      {
       nodeLink += "||" + HttpContext.Current.Server.HtmlEncode(nodeText);
      }

      treeElement.Action = String.Format("javascript:openContent('{0}');", nodeLink);
    }

    I'll update the cp ticket.


Please login or Sign up To post replies