commit: 13f01bbd402ab667e7ee80afc3cfaee2f7b92f44
parent: e352d548e49bb448ba2b1db46a61163f65ec6abb
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 7 Dec 2019 10:40:42 +0100
badwolf.c: Simplify badwolf_ensure_uri_scheme()
Diffstat:
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/badwolf.c b/badwolf.c
@@ -81,19 +81,7 @@ badwolf_ensure_uri_scheme(gchar *text, gboolean try_file)
soup_uri_free(uri);
- if(try_file)
- {
- gchar *f;
- char *path;
- path = realpath(text, NULL);
-
- if(path != NULL)
- {
- f = g_strdup_printf("file://%s", path);
- free(path);
- return f;
- }
- }
+ if(try_file && (access(text, R_OK) == 0)) return g_strdup_printf("file://%s", text);
return g_strdup_printf("http://%s", text);
}