Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message parser creates nested anchors in xhtml messages #497

Open
mazhe opened this issue Dec 21, 2016 · 0 comments
Open

Message parser creates nested anchors in xhtml messages #497

mazhe opened this issue Dec 21, 2016 · 0 comments

Comments

@mazhe
Copy link

mazhe commented Dec 21, 2016

Hi, it seems that the linkify() part of the message that convert links to ... elements do so with xhtml message, and thus create nested elements.

This is "bad" because 1. this is forbidden by the standard, but 2. some reformatters like the image inliner plugin will have issues with it (displays the images two times).

I did not dwell far in the code, but maybe something like that could be done in util.js to avoid the issue?

--- util.js.orig	2016-12-21 11:31:01.039794000 +0100
+++ util.js	2016-12-21 11:34:00.607994000 +0100
@@ -558,10 +558,11 @@
 		 * Returns:
 		 *   (String) Parsed text
 		 */
-		all: function(text) {
+		all: function(text, isXhtml=false) {
 			if(text) {
 				text = this.escape(text);
-				text = this.linkify(text);
+				if (isXhtml == false)
+					text = this.linkify(text);
 				text = this.emotify(text);
 				text = this.nl2br(text);
 			}
@@ -650,7 +651,7 @@
 			if(maxLength && currentLength > maxLength) {
 				text = text.substring(0, maxLength);
 			}
-			text = Candy.Util.Parser.all(text);
+			text = Candy.Util.Parser.all(text, true);
 			el = $.parseHTML(text);
 		}

(of course, that would mean assuming that xhtml message properly format links in their content...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant