Skip to content

Commit

Permalink
fix: escape single quotes in response body
Browse files Browse the repository at this point in the history
  • Loading branch information
NTBBloodbath committed May 27, 2021
1 parent d5a4022 commit da30eef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/rest-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ local function curl_cmd(opts)
if json_body then
-- Format JSON output and then add it into the buffer
-- line by line because Vim doesn't allow strings with newlines
local out = fn.system("echo -E '" .. line .. "' | jq .")
local out = fn.system("echo -E '" .. string.gsub(line, "[']", "\\%1") .. "' | jq .")
for _, _line in ipairs(utils.split(out, '\n')) do
line_count = api.nvim_buf_line_count(res_bufnr) - 1
api.nvim_buf_set_lines(
Expand Down

0 comments on commit da30eef

Please sign in to comment.