Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitb748c68f4c0557e4c663d8d108a45f3edfca1898 (patch)
Author
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-12-16 03:25:15 +0100
Committer
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-12-16 03:25:15 +0100
Filese84dd83ecadaf017e5a1a7b147f1f6819f11bfd5
goodwolf-b748c68f4c0557e4c663d8d108a45f3edfca1898.tar
goodwolf-b748c68f4c0557e4c663d8d108a45f3edfca1898.tar.gz
goodwolf-b748c68f4c0557e4c663d8d108a45f3edfca1898.zip
Parent9579ef40ff0c16b905a444903688f2f343ff91a6 (diff)
uri.c: Revert to g_uri_parse_scheme() instead of SoupURI
1 files changed, 3 insertions, 18 deletions
-rw-r--r--uri.c21
diff --git a/uri.c b/uri.c
index bc2bc01..7b97e48 100644
--- a/uri.c
+++ b/uri.c
@@ -4,6 +4,7 @@
#include "uri.h"
+#include <glib.h> /* g_strcmp0() */
#include <glib/gprintf.h> /* g_fprintf() */
#include <libsoup/soup.h> /* soup* */
#include <unistd.h> /* access() */
@@ -12,26 +13,10 @@ const gchar *
badwolf_ensure_uri_scheme(const gchar *text, gboolean try_file)
{
const gchar *fallback = "about:blank";
- SoupURI *uri;
- uri = soup_uri_new(text);
- if(!uri) return fallback;
+ if(g_strcmp0(text, "") <= 0) return fallback;
- //g_fprintf(stderr, "uri->scheme = %s, uri->path = %s\n", uri->scheme, uri->path);
-
- if(!uri->path)
- {
- soup_uri_free(uri);
- return fallback;
- }
-
- if(uri->scheme)
- {
- soup_uri_free(uri);
- return text;
- }
-
- soup_uri_free(uri);
+ if(g_uri_parse_scheme(text)) return text;
if(try_file && (access(text, R_OK) == 0)) return g_strdup_printf("file://%s", text);