Skip to content

Commit

Permalink
fix(manpages): safety for malformed entries (closes #1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed May 20, 2024
1 parent e53867b commit 6573114
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lua/fzf-lua/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ M.resume = function(_, _)
end

M.vimcmd = function(vimcmd, selected, noesc)
for i = 1, #selected do
vim.cmd(("%s %s"):format(vimcmd,
noesc and selected[i] or vim.fn.fnameescape(selected[i])))
for _, sel in ipairs(selected) do
vim.cmd(("%s %s"):format(vimcmd, noesc and sel or vim.fn.fnameescape(sel)))
end
end

Expand Down
2 changes: 1 addition & 1 deletion lua/fzf-lua/libuv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ M.shellescape = function(s, win_style)
else
local ret = nil
vim.o.shell = "sh"
if not s:match([["]]) and not s:match([[\]]) then
if s and not s:match([["]]) and not s:match([[\]]) then
-- if the original string does not contain double quotes,
-- replace surrounding single quote with double quotes,
-- temporarily replace all single quotes with double
Expand Down
3 changes: 2 additions & 1 deletion lua/fzf-lua/providers/manpages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ end
--- @param apropos_line string
--- @return string arg without shellescape
M.manpage_vim_arg = function(apropos_line)
return string.format("%s(%s)", parse_apropos(apropos_line))
local page, section = parse_apropos(apropos_line)
return string.format("%s(%s)", page, section)
end
--- @param apropos_line string
--- @return string arg with shellescape
Expand Down

0 comments on commit 6573114

Please sign in to comment.