Detect localhost and IPv6 as valid URLs. Fixes #478.
authorGeorge Bateman <george.bateman16@gmail.com>
Tue, 12 Jun 2018 14:26:16 +0000 (15:26 +0100)
committerGeorge Bateman <george.bateman16@gmail.com>
Tue, 12 Jun 2018 14:26:16 +0000 (15:26 +0100)
src/main.c

index 2910f12..0d34ac5 100644 (file)
@@ -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);
     }