[gnote] Fix bug in URL parsing causing file link when not appropriate.



commit 794be0b98d620dd99f145f678a0dd2def588d77b
Author: Hubert Figuiere <hub figuiere net>
Date:   Fri Jun 5 16:32:53 2009 -0400

    Fix bug in URL parsing causing file link when not appropriate.
    (Closes #581506)
    (taken from Tomboy)
---
 NEWS             |    2 ++
 src/watchers.cpp |    5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 103544d..471e75f 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ Fixes:
     (Gilles Dartiguelongue)
   * Don't open the start note if it is an applet. (Closes #584583)
   * Update boost.m4 to latest version. (Closes #581559) (Priit Laes)
+  * Fix bug in URL parsing causing file link when not appropriate.
+    (Closes #581506)
 
 Translations:
 
diff --git a/src/watchers.cpp b/src/watchers.cpp
index 660fca7..489dd3c 100644
--- a/src/watchers.cpp
+++ b/src/watchers.cpp
@@ -385,13 +385,12 @@ namespace gnote {
   ////////////////////////////////////////////////////////////////////////
 
 
-  const char * NoteUrlWatcher::URL_REGEX = "((\\b((news|http|https|ftp|file|irc)://|mailto:|(www|ftp)\\.|\\S* \\S*\\ )|/\\S+/|~/\\S+)\\S*\\b/?)";
-
+  const char * NoteUrlWatcher::URL_REGEX = "((\\b((news|http|https|ftp|file|irc)://|mailto:|(www|ftp)\\.|\\S* \\S*\\ )|(?<=^|\\s)/\\S+/|(?<=^|\\s)~/\\S+)\\S*\\b/?)";
   bool NoteUrlWatcher::s_text_event_connected = false;
   
 
   NoteUrlWatcher::NoteUrlWatcher()
-    : m_regex(URL_REGEX, boost::regex::extended|boost::regex_constants::icase)
+    : m_regex(URL_REGEX, boost::regex::perl|boost::regex_constants::icase)
   {
   }
 



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