You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "Vigneshwaran Raveendran (Created) (JIRA)" <ji...@apache.org> on 2011/12/20 10:35:30 UTC

[jira] [Created] (JSPWIKI-712) Entities in ChangeNote should be decoded when "keep editing"

Entities in ChangeNote should be decoded when "keep editing"
------------------------------------------------------------

                 Key: JSPWIKI-712
                 URL: https://issues.apache.org/jira/browse/JSPWIKI-712
             Project: JSPWiki
          Issue Type: Bug
          Components: Default template
    Affects Versions: 2.8.4
         Environment: Windows XP, Tomcat 7.0
            Reporter: Vigneshwaran Raveendran
            Priority: Minor


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 &amp;quot;quotes&amp;quot; &amp;amp; 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 &amp;quot;quotes&amp;quot; &amp;amp; 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;amp;/g,"&")
    .replace(/&amp;lt;/g,"<")
    .replace(/&amp;gt;/g,">")
    .replace(/&amp;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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JSPWIKI-712) Entities in ChangeNote should be decoded when "keep editing"

Posted by "brushed (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13176802#comment-13176802 ] 

brushed commented on JSPWIKI-712:
---------------------------------

Agree this is a bug.
However, I think the root casue of the problem is in edit.jsp, and would better be solved there.
BTW, the same wrong behaviour is happening on other fields like author and link, which you can set when adding a comment to a page.

Need to dig a bit deeper for a solution.

dirk
                
> Entities in ChangeNote should be decoded when "keep editing"
> ------------------------------------------------------------
>
>                 Key: JSPWIKI-712
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-712
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Default template
>    Affects Versions: 2.8.4
>         Environment: Windows XP, Tomcat 7.0
>            Reporter: Vigneshwaran Raveendran
>            Assignee: brushed
>            Priority: Minor
>              Labels: fix, javascript
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> 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 &amp;quot;quotes&amp;quot; &amp;amp; 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 &amp;quot;quotes&amp;quot; &amp;amp; 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;amp;/g,"&")
>     .replace(/&amp;lt;/g,"<")
>     .replace(/&amp;gt;/g,">")
>     .replace(/&amp;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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JSPWIKI-712) Entities in ChangeNote should be decoded when "keep editing"

Posted by "Harry Metske (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174297#comment-13174297 ] 

Harry Metske commented on JSPWIKI-712:
--------------------------------------

I agree this is a bug.
Any comments on the suggested solution (Dirk) ?
                
> Entities in ChangeNote should be decoded when "keep editing"
> ------------------------------------------------------------
>
>                 Key: JSPWIKI-712
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-712
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Default template
>    Affects Versions: 2.8.4
>         Environment: Windows XP, Tomcat 7.0
>            Reporter: Vigneshwaran Raveendran
>            Priority: Minor
>              Labels: fix, javascript
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> 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 &amp;quot;quotes&amp;quot; &amp;amp; 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 &amp;quot;quotes&amp;quot; &amp;amp; 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;amp;/g,"&")
>     .replace(/&amp;lt;/g,"<")
>     .replace(/&amp;gt;/g,">")
>     .replace(/&amp;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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JSPWIKI-712) Entities in ChangeNote should be decoded when "keep editing"

Posted by "Florian Holeczek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JSPWIKI-712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Florian Holeczek updated JSPWIKI-712:
-------------------------------------

     Affects Version/s: 2.9
    Remaining Estimate:     (was: 0.25h)
     Original Estimate:     (was: 0.25h)

Still present in v2.9.0-incubating-6
Guess we will move this to 2.9.1.
                
> Entities in ChangeNote should be decoded when "keep editing"
> ------------------------------------------------------------
>
>                 Key: JSPWIKI-712
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-712
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Default template
>    Affects Versions: 2.8.4, 2.9
>         Environment: Windows XP, Tomcat 7.0
>            Reporter: Vigneshwaran Raveendran
>            Assignee: brushed
>            Priority: Minor
>              Labels: fix, javascript
>
> 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 &amp;quot;quotes&amp;quot; &amp;amp; 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 &amp;quot;quotes&amp;quot; &amp;amp; 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;amp;/g,"&")
>     .replace(/&amp;lt;/g,"<")
>     .replace(/&amp;gt;/g,">")
>     .replace(/&amp;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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira