[evolution-patches] Fix for Bug 270487[gtkhtml]-resent



Hi

Attached Fix for Bug 270487 – autourlified URLs not html-escaped

Please Review.

Thanks,
Rohini
        
Index: htmltokenizer.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmltokenizer.c,v
retrieving revision 1.78
diff -u -p -r1.78 htmltokenizer.c
--- htmltokenizer.c	13 May 2004 15:07:33 -0000	1.78
+++ htmltokenizer.c	10 Feb 2006 14:11:33 -0000
@@ -89,6 +89,7 @@ struct _HTMLTokenizerPrivate {
 	gboolean select; /* Are we in a <select> block? */
 	gboolean charEntity; /* Are we in an &... sequence? */
 	gboolean extension; /* Are we in an <!-- +GtkHTML: sequence? */
+	gboolean aTag; /* Are we in a <a/> tag*/
  
 	enum {
 		NoneDiscard = 0,
@@ -233,6 +234,7 @@ html_tokenizer_init (HTMLTokenizer *t)
 	p->select = FALSE;
 	p->charEntity = FALSE;
 	p->extension = FALSE;
+	p->aTag = FALSE;
 
 	p->discard = NoneDiscard;
 	p->pending = NonePending;
@@ -1091,6 +1093,9 @@ end_tag (HTMLTokenizer *t, const gchar *
 	}
 	else if (strncmp (p->buffer + 2, "tablesdkl", 9) == 0) {
 		html_tokenizer_blocking_push (t, Table);
+	}	
+	else if (strncmp (p->buffer + 2, "/a", 2) == 0) {
+		p->aTag = FALSE;
 	}
 	else {
 		if (p->blocking) {
@@ -1148,6 +1153,8 @@ in_crlf (HTMLTokenizer *t, const gchar *
 static void
 in_space_or_tab (HTMLTokenizer *t, const gchar **src)
 {
+	gchar *ptr;
+	
 	if (t->priv->tquote) {
 		if (t->priv->discard == NoneDiscard)
 			t->priv->pending = SpacePending;
@@ -1156,6 +1163,9 @@ in_space_or_tab (HTMLTokenizer *t, const
 		t->priv->searchCount = 0; /* Stop looking for <!-- sequence */
 		if (t->priv->discard == NoneDiscard)
 			t->priv->pending = SpacePending;
+		ptr = t->priv->buffer;
+		if (ptr[1] == '<' && ptr[2] == 'a' && strlen (ptr) == 3)
+			t->priv->aTag = TRUE;
 	}
 	else if (t->priv->pre || t->priv->textarea) {
 		if (t->priv->pending)
@@ -1285,7 +1295,7 @@ html_tokenizer_tokenize_one_char (HTMLTo
 		in_entity (t, src);
 	else if (p->startTag)
 		in_tag (t, src);
-	else if (**src == '&')
+	else if (**src == '&' && !p->aTag)
 		start_entity (t, src);
 	else if (**src == '<' && !p->tag)
 		start_tag (t, src);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2161
diff -u -p -r1.2161 ChangeLog
--- ChangeLog	9 Feb 2006 06:33:15 -0000	1.2161
+++ ChangeLog	10 Feb 2006 14:16:01 -0000
@@ -1,3 +1,13 @@
+2006-02-10  Rohini S  <srohini novell com>
+
+	* htmltokenizer.c (html_tokenizer_init), (end_tag), (in_space_or_tab),
+	(html_tokenizer_tokenize_one_char): Modified _HTMLTokenizerPrivate struct
+	to include a new boolean member variable aTag which checks if the tokenizer 
+	is currently parsing a Link. The functions are modified to escape HTML 
+	entities in a URL.
+
+	Fixes bug #270487
+
 2006-02-09  Irene Huang <Irene Huang sun com>
 
 	Fixes bug #318973


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]