SF.net SVN: geany-plugins:[546] trunk/addons/src/ao_openuri.c
eht16 at users.sourceforge.net
eht16 at xxxxx
Fri Mar 13 17:24:17 UTC 2009
Revision: 546
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=546&view=rev
Author: eht16
Date: 2009-03-13 17:24:17 +0000 (Fri, 13 Mar 2009)
Log Message:
-----------
Make the check for a valid URI a bit stricter to reduce the amount of false-positives.
Modified Paths:
--------------
trunk/addons/src/ao_openuri.c
Modified: trunk/addons/src/ao_openuri.c
===================================================================
--- trunk/addons/src/ao_openuri.c 2009-03-13 00:17:07 UTC (rev 545)
+++ trunk/addons/src/ao_openuri.c 2009-03-13 17:24:17 UTC (rev 546)
@@ -193,10 +193,16 @@
static gboolean ao_uri_is_link(const gchar *uri)
{
+ gchar *dot;
+
g_return_val_if_fail (uri != NULL, FALSE);
- /* this might cause too many matches, maybe we should require two dots */
- return (strchr(uri, '.') && ! strchr(uri, ' '));
+ if ((dot = strchr(uri, '.')) && *dot != '\0')
+ { /* we require two dots and don't allow any spaces (www.domain.tld)
+ * unless we get too many matches */
+ return (strchr(dot + 1, '.') && ! strchr(uri, ' '));
+ }
+ return FALSE;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Plugins-Commits
mailing list