From 61d6da99ed996e40e356ed1f9063f156ca5a8892 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pawe=C5=82=20Forysiuk?= Date: Fri, 1 Apr 2011 16:10:16 +0200 Subject: [PATCH] Fix uri matching for addon infobar on userstyles.org We want to match a style, with a number in the URI, but not when browsing styles. --- extensions/addons.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/extensions/addons.c b/extensions/addons.c index d0998121..62030cf1 100644 --- a/extensions/addons.c +++ b/extensions/addons.c @@ -1,7 +1,7 @@ /* Copyright (C) 2008 Christian Dywan Copyright (C) 2008-2010 Arno Renevier - Copyright (C) 2010 Paweł Forysiuk + Copyright (C) 2010-2011 Paweł Forysiuk This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -152,15 +152,10 @@ addons_install_response (GtkWidget* infobar, } else if (!g_strcmp0 (hostname, "userstyles.org")) { - gchar* subpage; + gchar* subpage = split_uri[4]; folder = "styles"; - if (g_str_has_suffix (uri, "/")) - subpage = split_uri[6]; - else - subpage = split_uri[5]; - - if (!subpage) + if ((subpage && *subpage) && g_ascii_isdigit (subpage[0])) { gchar* style_id; const gchar* js_script; @@ -278,14 +273,10 @@ addons_notify_load_status_cb (MidoriView* view, else if (g_str_has_prefix (uri, "http://userstyles.org/styles/")) { gchar** split_uri = g_strsplit (uri, "/", -1); - gchar* subpage; + gchar* subpage = split_uri[4]; - if (g_str_has_suffix (uri, "/")) - subpage = split_uri[6]; - else - subpage = split_uri[5]; /* userstyles.org style main page with style description */ - if (!subpage) + if ((subpage && *subpage) && g_ascii_isdigit (subpage[0])) addons_uri_install (view, ADDONS_USER_STYLES); g_strfreev (split_uri); -- 2.39.5