Uploaded image for project: 'JSPWiki'
  1. JSPWiki
  2. JSPWIKI-712

Entities in ChangeNote should be decoded when "keep editing"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.8.4, 2.9
    • 2.10.1
    • Templates and UI
    • Windows XP, Tomcat 7.0

    Description

      Steps to reproduce the bug:-
      1. Go here: http://doc.jspwiki.org/2.4/Edit.jsp?page=WindowsInstall
      2. Type in changenote: Testing "quotes" & ampersand
      3. Click preview
      4. Click Keep Editing
      5. The changenote looks like this: Testing "quotes" & ampersand

      Now the user has to remove it and type (Testing "quotes" & ampersand) again before saving. If the user didn't notice it, then the comment will be saved as "Testing "quotes" & ampersand" in the history.

      =================================================

      I know that entities need to be encoded for security reasons but this is a Bug.

      When "keep editing" button is clicked, the comment should appear in decoded format. For that, there should be a javascript that execute "after" the page is loaded. No need to change any of the TextUtil.replaceEntities() methods.

      =================================================

      This is how I fixed it in my pc:
      1. Added the following script to commonheader.jsp (or prettify.js)

      <script type="text/javascript">
      function decodeChangeNote() {
      document.getElementById("changenote").value =
      document.getElementById("changenote").value
      .replace(/&amp;/g,"&")
      .replace(/&lt;/g,"<")
      .replace(/&gt;/g,">")
      .replace(/&quot;/g,"\"");
      }
      </script>

      2. Changed <body> tag in EditTemplate.jsp to call this js function on load.

      <body onload="decodeChangeNote()">

      ====================================================

      Now JSPWiki works fine for me. Polish this fix if needed and commit it. Please correct me if I'm wrong.

      Attachments

        1. JSPWIKI-712-test3.png
          88 kB
          Harry Metske
        2. JSPWIKI-712-test2.png
          77 kB
          Harry Metske
        3. JSPWIKI-712-test1.png
          48 kB
          Harry Metske
        4. JSPWIKI-712.patch
          0.8 kB
          Harry Metske

        Activity

          People

            brushed Dirk Frederickx
            vigneshwaran Vigneshwaran Raveendran
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: