Copied to clipboard

Flag this post as spam?

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


  • dandrayne 1138 posts 2262 karma points
    Jan 20, 2011 @ 14:04
    dandrayne
    0

    Apostrophe in page name breaks insert link dialogue

    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

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 20, 2011 @ 14:44
    Tom Fulton
    0

    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

  • dandrayne 1138 posts 2262 karma points
    Jan 20, 2011 @ 14:49
    dandrayne
    0

    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 56 posts 155 karma points
    Jan 22, 2011 @ 03:27
    Doug Mackay
    0

    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 Sign in or register to post replies

Write your reply to:

Draft