diff --git a/midori/midori-browser.c b/midori/midori-browser.c index e0b62ca3..2f1b702b 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1608,7 +1608,9 @@ midori_browser_location_key_press_event_cb (GtkWidget* widget, g_object_get (browser->settings, "location-entry-search", &location_entry_search, NULL); gchar* new_uri = sokoke_magic_uri (uri, browser->search_engines); - if (!new_uri) + if (!new_uri && strstr (location_entry_search, "%s")) + new_uri = g_strdup_printf (location_entry_search, uri); + else if (!new_uri) new_uri = g_strdup (location_entry_search); g_free (location_entry_search); /* TODO: Use new_uri intermediately when completion is better diff --git a/midori/sokoke.c b/midori/sokoke.c index 277ee718..49896e2a 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -28,12 +28,6 @@ gchar* sokoke_magic_uri (const gchar* uri, MidoriWebList* search_engines) { - g_return_val_if_fail (uri, NULL); - if (search_engines) - { - g_return_val_if_fail (MIDORI_IS_WEB_LIST (search_engines), NULL); - } - gchar* current_dir; gchar* result; gchar* search; @@ -41,6 +35,10 @@ sokoke_magic_uri (const gchar* uri, gchar** parts; MidoriWebItem* web_item; + g_return_val_if_fail (uri, NULL); + if (search_engines) + g_return_val_if_fail (MIDORI_IS_WEB_LIST (search_engines), NULL); + /* Add file:// if we have a local path */ if (g_path_is_absolute (uri)) return g_strconcat ("file://", uri, NULL); @@ -73,6 +71,7 @@ sokoke_magic_uri (const gchar* uri, if (web_item) search_uri = midori_web_item_get_uri (web_item); } + g_free (parts); if (search_uri) search = g_strdup_printf (search_uri, parts[1]); return search;