mirror of
https://github.com/igniterealtime/Spark.git
synced 2026-08-18 11:10:02 +00:00
SPARK-285 link-2-text filter matches too much URL's or text which looks like an URL
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4628 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -178,7 +178,7 @@ public class ChatArea extends JTextPane implements MouseListener, MouseMotionLis
|
||||
setCursor(HAND_CURSOR);
|
||||
|
||||
// Make sure the message is not null.
|
||||
message = message.trim();
|
||||
// message = message.trim();
|
||||
message = message.replaceAll("/\"", "");
|
||||
if (ModelUtil.hasLength(message)) {
|
||||
try {
|
||||
@ -225,11 +225,11 @@ public class ChatArea extends JTextPane implements MouseListener, MouseMotionLis
|
||||
boolean underlined = false;
|
||||
|
||||
|
||||
StringTokenizer t = new StringTokenizer(text, " \n", true);
|
||||
while (t.hasMoreTokens()) {
|
||||
String textFound = t.nextToken();
|
||||
final StringTokenizer tokenizer = new StringTokenizer(text, " \n \tokenizer", true);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
String textFound = tokenizer.nextToken();
|
||||
if (textFound.startsWith("http://") || textFound.startsWith("ftp://")
|
||||
|| textFound.startsWith("https://") || textFound.startsWith("www") || textFound.startsWith("\\") || textFound.indexOf("://") != -1) {
|
||||
|| textFound.startsWith("https://") || textFound.startsWith("www.") || textFound.startsWith("\\") || textFound.indexOf("://") != -1) {
|
||||
insertLink(textFound);
|
||||
}
|
||||
else if (!insertImage(textFound)) {
|
||||
|
||||
Reference in New Issue
Block a user