From 06b34a53c2c7af02fbc673d53b5c13f40c2933a6 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 16 Dec 2019 01:47:12 +0100 Subject: Add tests on badwolf_ensure_uri_scheme --- badwolf.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 909df75..627cb3f 100644 --- a/badwolf.c +++ b/badwolf.c @@ -6,13 +6,13 @@ #include "config.h" #include "keybindings.h" +#include "uri.h" #include /* _() and other internationalization/localization helpers */ #include /* g_fprintf() */ #include /* soup* */ #include /* LC_* */ #include /* malloc() */ -#include /* access() */ const gchar *homepage = "https://hacktivis.me/projects/badwolf"; const gchar *version = VERSION; @@ -63,30 +63,6 @@ static void closeCb_clicked(GtkButton *close, gpointer user_data); static void notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data); -const gchar * -badwolf_ensure_uri_scheme(const gchar *text, gboolean try_file) -{ - SoupURI *uri = soup_uri_new(text); - - if(uri->path == NULL || text == NULL) - { - soup_uri_free(uri); - return "about:blank"; - } - - if(uri->scheme != NULL) - { - soup_uri_free(uri); - return text; - } - - soup_uri_free(uri); - - if(try_file && (access(text, R_OK) == 0)) return g_strdup_printf("file://%s", text); - - return g_strdup_printf("http://%s", text); -} - static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data) { -- cgit v1.3.1-23-gd82d