Invalid formatting in space.vmd of URL links to blog comments in News Items page if non-ascii characters present in blog title

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 1.4.2
    • Affects Version/s: 1.4.1
    • Component/s: None

      There is bug in space.vmd decorator fragment:

      #if ($blog.comments.size() > 0)
      <a href="$req.contextPath$generalUtil.getPageUrl($blog)?showComments=true#comments">$blog.comments.size() comment#if($blog.comments.size() > 1)s#end</a>
      #else
      <a href="$req.contextPath$generalUtil.getPageUrl($blog)?showComments=true#comments">0 comments</a>
      #end

      If blog title contains national (non-ascii) character then $generalUtil.getPageUrl($blog) returns something like /pages/viewpage.action?pageId=xxx
      As a result the final URL is
      /pages/viewpage.action?pageId=xxx?showComments=true#comments
      which gives server exception when clicked (as it contains two ? in URL, in this case second ? should be replaced with &)

      The following workaround was made to avoid this issue:

      #if ($generalUtil.getPageUrl($blog).indexOf("?") < 0)
      #set( $sep = "?" )
      #else
      #set( $sep = "&" )
      #end
      #if ($blog.comments.size() > 0)
      <a href="$req.contextPath$generalUtil.getPageUrl($blog)${sep}showComments=true#comments">$blog.comments.size() comment#if($blog.comments.size() > 1)s#end</a>
      #else
      <a href="$req.contextPath$generalUtil.getPageUrl($blog)${sep}showComments=true#comments">0 comments</a>
      #end

              Assignee:
              Unassigned
              Reporter:
              Raimonds Simanovskis
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: