Ticket #1908 (closed Bug: fixed)

Opened 2 years ago

Last modified 22 months ago

HtmlEncodeOutput unescapes incorrectly on some strings

Reported by: acolwell Owned by: alfonsoml
Priority: Normal Milestone: FCKeditor 2.6.1
Component: Server : ASP.Net Version: SVN (FCKeditor)
Keywords: HasPatch Review+ Cc:

Description (last modified by alfonsoml) (diff)

In FCKeditor.LoadPostData() the code that handles reverting the HtmlEncodeOutput changes does not work properly for strings that contain "&amp;lt;" or "&amp;gt;". The current code replaces '&amp;' before '&lt;' and '&gt;' which causes the strings mentioned to be converted to '<' and '>' respectively. What should happen is that the '&amp;' replacement should happen after the '&lt;' and '&gt;' replacement. This allows the strings to be converted to '&lt;' and '&gt;' which I believe is the proper decoding.

Here is a patch that fixes this problem.

Index: FCKeditor.cs
===================================================================
--- FCKeditor.cs        (revision 1585)
+++ FCKeditor.cs        (working copy)
@@ -456,9 +456,9 @@
                        // Revert the HtmlEncodeOutput changes.
                        if ( this.Config["HtmlEncodeOutput"] != "false" )
                        {
-                               postedValue = postedValue.Replace( "&amp;", "&" ) ;
                                postedValue = postedValue.Replace( "&lt;", "<" ) ;
                                postedValue = postedValue.Replace( "&gt;", ">" ) ;
+                               postedValue = postedValue.Replace("&amp;", "&");
                        }

                        if ( postedValue != this.Value )

Attachments

1908.patch Download (0.5 KB) - added by alfonsoml 22 months ago.
Patch as a file

Change History

Changed 2 years ago by w.olchawa

  • keywords HasPatch added

Changed 22 months ago by alfonsoml

Patch as a file

Changed 22 months ago by alfonsoml

  • keywords Review? added
  • owner set to alfonsoml
  • status changed from new to assigned
  • description modified (diff)

I've attached the proposed patch for review. I'm not sure about the current released version of FCKeditor.net, so I haven't changed the what's new file

Changed 22 months ago by fredck

  • keywords Review+ added; Review? removed
  • milestone set to FCKeditor 2.6.1

I've appended a new version to the changelog file with [2021]. Feel free to use that for this ticket.

Changed 22 months ago by alfonsoml

  • status changed from assigned to closed
  • resolution set to fixed

Fixed with [2024]

Thanks acolwell.

Changed 22 months ago by fredck

#2225 has been marked as DUP.

Note: See TracTickets for help on using tickets.