Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.12.5, LuaJIT 2.1.1788460057
Operating system/version
Arch Linux
Describe the bug
For a repository whose remote uses plain http:// (e.g.: self-hosted GitLab instances on an internal network), Snacks.gitbrowse() opens an invalid URL with two schemes glued together:
remote: http://git.example.com/group/subgroup/repo.git
opened: https://http://git.example.com/group/subgroup/repo
The cause is in M.get_repo() (lua/snacks/gitbrowse.lua:96):
return ret:find("https://") == 1 and ret or ("https://%s"):format(ret)
Although the remote_patterns loop handles http correctly with { "^(https?://.*)%.git$", "%1" }, the final scheme check only recognizes https://. Therefore, an http URL that already has a scheme is treated as schemeless and gets https:// prepended.
No error is shown; the notification and the browser both receive the malformed URL.
Steps To Reproduce
- Create a repo with a plain-http remote:
mkdir /tmp/gitbrowse-http && cd /tmp/gitbrowse-http
git init -q .
printf 'line1\nline2\nline3\n' > README.md
git add README.md && git commit -qm init
git remote add origin http://git.example.com/group/subgroup/repo.git
- Open the file:
nvim README.md
- Type
<leader>gY and then paste.
- The printed URL is
https://http://git.example.com/group/subgroup/repo
Expected Behavior
In the example above, I expect to see http://git.example.com/group/subgroup/repo
Repro
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{ "folke/snacks.nvim", opts = {} },
-- add any other plugins here
},
})
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.12.5, LuaJIT 2.1.1788460057
Operating system/version
Arch Linux
Describe the bug
For a repository whose remote uses plain
http://(e.g.: self-hosted GitLab instances on an internal network),Snacks.gitbrowse()opens an invalid URL with two schemes glued together:The cause is in
M.get_repo()(lua/snacks/gitbrowse.lua:96):Although the
remote_patternsloop handles http correctly with{ "^(https?://.*)%.git$", "%1" }, the final scheme check only recognizeshttps://. Therefore, an http URL that already has a scheme is treated as schemeless and getshttps://prepended.No error is shown; the notification and the browser both receive the malformed URL.
Steps To Reproduce
nvim README.md<leader>gYand then paste.https://http://git.example.com/group/subgroup/repoExpected Behavior
In the example above, I expect to see
http://git.example.com/group/subgroup/repoRepro