diff options
| author | Tom Ampuero <46233260+tampueroc@users.noreply.github.com> | 2026-04-05 20:22:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-05 15:22:26 -0400 |
| commit | 6d420feaefd62d2b67ed58913bd5a9922102b414 (patch) | |
| tree | 0d635c032343762eadf0021ae0660b03424e44b1 /test/functional/lua | |
| parent | cfbac232355717fef91d8c256b02ce6919ff5c46 (diff) | |
fix(net): handle remote archive URLs via tar/zip browse #38744
Problem:
Opening .tar.gz or .zip URLs shows raw binary instead of using the archive plugins.
Solution:
Similar to the original netrw implementation, the autocmd should detect
archive URLs, download them to a temp file and the open them with
tar/zip handlers already bundled as vim plugins.
Diffstat (limited to 'test/functional/lua')
| -rw-r--r-- | test/functional/lua/net_spec.lua | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/functional/lua/net_spec.lua b/test/functional/lua/net_spec.lua index 253f7c30d4..2057ce3331 100644 --- a/test/functional/lua/net_spec.lua +++ b/test/functional/lua/net_spec.lua @@ -113,4 +113,54 @@ describe('vim.net.request', function() t.eq(true, content[1]:find('Here') ~= nil) t.eq(true, content[2]:find('html') ~= nil) end) + + it('opens remote tar.gz URLs as tar archives', function() + t.skip(skip_integ, 'NVIM_TEST_INTEG not set: skipping network integration test') + + local rv = exec_lua([[ + vim.cmd('runtime! plugin/net.lua') + vim.cmd('runtime! plugin/tarPlugin.vim') + + vim.cmd('edit https://github.com/neovim/neovim/releases/download/nightly/nvim-macos-x86_64.tar.gz') + + vim.wait(2500, function() + return vim.bo.filetype == 'tar' or vim.b.tarfile ~= nil + end) + + return { + filetype = vim.bo.filetype, + modified = vim.bo.modified, + tarfile = vim.b.tarfile ~= nil, + } + ]]) + + t.eq('tar', rv.filetype) + t.eq(false, rv.modified) + t.eq(true, rv.tarfile) + end) + + it('opens remote zip URLs as zip archives', function() + t.skip(skip_integ, 'NVIM_TEST_INTEG not set: skipping network integration test') + + local rv = exec_lua([[ + vim.cmd('runtime! plugin/net.lua') + vim.cmd('runtime! plugin/zipPlugin.vim') + + vim.cmd('edit https://github.com/neovim/neovim/releases/download/nightly/nvim-win-arm64.zip') + + vim.wait(2500, function() + return vim.bo.filetype == 'zip' or vim.b.zipfile ~= nil + end) + + return { + filetype = vim.bo.filetype, + modified = vim.bo.modified, + zipfile = vim.b.zipfile ~= nil, + } + ]]) + + t.eq('zip', rv.filetype) + t.eq(false, rv.modified) + t.eq(true, rv.zipfile) + end) end) |
