Skip to content

Commit 5aa0999

Browse files
authored
fix(curl): check if body string is file - expand errors if body contains $ (#338)
1 parent 63bae0f commit 5aa0999

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/plenary/curl.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,14 @@ end
182182
parse.request = function(opts)
183183
if opts.body then
184184
local b = opts.body
185+
local silent_is_file = function()
186+
local status, result = pcall(P.is_file, P.new(b))
187+
return status and result
188+
end
185189
opts.body = nil
186190
if type(b) == "table" then
187191
opts.data = b
188-
elseif P.is_file(P.new(b)) then
192+
elseif silent_is_file() then
189193
opts.in_file = b
190194
elseif type(b) == "string" then
191195
opts.raw_body = b

0 commit comments

Comments
 (0)