Skip to content

Commit da30eef

Browse files
committed
fix: escape single quotes in response body
1 parent d5a4022 commit da30eef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/rest-nvim/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ local function curl_cmd(opts)
260260
if json_body then
261261
-- Format JSON output and then add it into the buffer
262262
-- line by line because Vim doesn't allow strings with newlines
263-
local out = fn.system("echo -E '" .. line .. "' | jq .")
263+
local out = fn.system("echo -E '" .. string.gsub(line, "[']", "\\%1") .. "' | jq .")
264264
for _, _line in ipairs(utils.split(out, '\n')) do
265265
line_count = api.nvim_buf_line_count(res_bufnr) - 1
266266
api.nvim_buf_set_lines(

0 commit comments

Comments
 (0)