From: George Bateman Date: Tue, 12 Jun 2018 14:26:16 +0000 (+0100) Subject: Detect localhost and IPv6 as valid URLs. Fixes #478. X-Git-Url: https://git.owens.tech/projects.html/projects.html/git?a=commitdiff_plain;h=2cc226cf1592a60b97217c5938a1b4ddad0fd3b2;p=vimb.git Detect localhost and IPv6 as valid URLs. Fixes #478. --- diff --git a/src/main.c b/src/main.c index 2910f12..0d34ac5 100644 --- a/src/main.c +++ b/src/main.c @@ -382,8 +382,11 @@ gboolean vb_load_uri(Client *c, const Arg *arg) rp = realpath(path, NULL); uri = g_strconcat("file://", rp, NULL); free(rp); - } else if (strchr(path, ' ') || !strchr(path, '.')) { - /* use a shortcut if path contains spaces or no dot */ + } else if (strchr(path, ' ') || !(strchr(path, '.') || + (strchr(path, '[') && strchr(path, ':') && strchr(path, ']')) || + strstr(path, "localhost"))) { + /* use a shortcut if path contains spaces or doesn't contain typical + * characters ('.', [:] for IPv6 addresses, 'localhost') */ uri = shortcut_get_uri(c->config.shortcuts, path); }