From 30aa09c5947724e6c92ede2728a23f25ed8ee8c6 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 8 Aug 2025 17:32:54 +0530 Subject: Support file/null protocols as urls in extras.search-engines --- lua/null-browser/extras/search-engines.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/null-browser/extras/search-engines.lua b/lua/null-browser/extras/search-engines.lua index e381a89..889128e 100644 --- a/lua/null-browser/extras/search-engines.lua +++ b/lua/null-browser/extras/search-engines.lua @@ -18,7 +18,11 @@ function M.transform_url_input(input) return M.substitute(M.default, url) end -function M.is_url(str) return string.match(str, "^https?://") end +function M.is_url(str) + local protocol = string.gsub(str, '://.*$', '') + local patterns = { 'https', 'http', 'file', 'null' } + return web.utils.table_contains(patterns, protocol) +end function M.substitute(search_name, value) local res, _ = string.gsub(M.urls[search_name], '{}', value) -- cgit v1.3.1