Summary Files Commits Branches @commit @diff @stats
path: root / badwolf.c
diff options
context:
space:
mode:
Commite5ecaf777659e8d3a625002826c4a1a3f8b31801 (patch)
Author
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-12-13 14:06:33 +0100
Committer
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-12-13 14:21:36 +0100
Filesa11aa60bada7c94cb954eb2832580bb4824cf80f /badwolf.c
goodwolf-e5ecaf777659e8d3a625002826c4a1a3f8b31801.tar
goodwolf-e5ecaf777659e8d3a625002826c4a1a3f8b31801.tar.gz
goodwolf-e5ecaf777659e8d3a625002826c4a1a3f8b31801.zip
Parent2a4e981821edcf340d1324560e95c08a4674bc22 (diff)
badwolf.c: Use SoupURI instead of g_uri_parse_scheme()
1 files changed, 14 insertions, 3 deletions
-rw-r--r--badwolf.c17
diff --git a/badwolf.c b/badwolf.c
index fe40193..e85f189 100644
--- a/badwolf.c
+++ b/badwolf.c
@@ -9,6 +9,7 @@
#include <glib/gi18n.h> /* _() and other internationalization/localization helpers */
#include <glib/gprintf.h> /* g_fprintf() */
+#include <libsoup/soup.h> /* soup* */
#include <locale.h> /* LC_* */
#include <stdlib.h> /* realpath(), malloc() */
@@ -64,11 +65,21 @@ notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num,
gchar *
badwolf_ensure_uri_scheme(gchar *text, gboolean try_file)
{
- if(text == NULL) return "about:blank";
+ SoupURI *uri = soup_uri_new(text);
- char *scheme = g_uri_parse_scheme(text);
+ if(uri->path == NULL)
+ {
+ soup_uri_free(uri);
+ return "about:blank";
+ }
+
+ if(uri->scheme != NULL)
+ {
+ soup_uri_free(uri);
+ return text;
+ }
- if(scheme != NULL) return text;
+ soup_uri_free(uri);
if(try_file)
{