From 83133f66c8c265cfe41ee21828c88222c776cf18 Mon Sep 17 00:00:00 2001 From: James Trew <66286082+jamestrew@users.noreply.github.com> Date: Tue, 29 Aug 2023 10:36:56 -0400 Subject: [PATCH] fix(utils): `is_uri` empty path (#2671) --- lua/telescope/utils.lua | 2 +- lua/tests/automated/utils_spec.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 40f18bd..652a146 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -174,7 +174,7 @@ utils.is_path_hidden = function(opts, path_display) end utils.is_uri = function(filename) - local char = string.byte(filename, 1) + local char = string.byte(filename, 1) or 0 -- is alpha? if char < 65 or (char > 90 and char < 97) or char > 122 then diff --git a/lua/tests/automated/utils_spec.lua b/lua/tests/automated/utils_spec.lua index 491f55a..5edf356 100644 --- a/lua/tests/automated/utils_spec.lua +++ b/lua/tests/automated/utils_spec.lua @@ -27,6 +27,7 @@ describe("is_uri", function() "hello", "hello:", "123", + "", } for _, input in ipairs(inputs) do it(input, function()