diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-08-08 17:32:54 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-08-08 17:32:54 +0530 |
| commit | 30aa09c5947724e6c92ede2728a23f25ed8ee8c6 (patch) | |
| tree | 408412ec0cc6ee155830fe33f55c595ba90a386d | |
| parent | 8ec50e55a45af1706d40eff292db4541b6fcc261 (diff) | |
| download | null-browser-30aa09c5947724e6c92ede2728a23f25ed8ee8c6.tar.gz null-browser-30aa09c5947724e6c92ede2728a23f25ed8ee8c6.zip | |
Support file/null protocols as urls in extras.search-engines
| -rw-r--r-- | lua/null-browser/extras/search-engines.lua | 6 |
1 files changed, 5 insertions, 1 deletions
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) |
