diff --git a/lua/img-clip/clipboard.lua b/lua/img-clip/clipboard.lua index d7c16b5..e11dbc4 100644 --- a/lua/img-clip/clipboard.lua +++ b/lua/img-clip/clipboard.lua @@ -153,7 +153,7 @@ M.get_content = function() -- Windows elseif cmd == "powershell.exe" then - local output, exit_code = util.execute([[powershell -command "Get-Clipboard -Text"]]) + local output, exit_code = util.execute([[powershell -command "Get-Clipboard"]]) if exit_code == 0 then return output:match("^[^\n]+") end diff --git a/lua/img-clip/fs.lua b/lua/img-clip/fs.lua index c7e4b37..24fc900 100644 --- a/lua/img-clip/fs.lua +++ b/lua/img-clip/fs.lua @@ -164,7 +164,7 @@ M.get_base64_encoded_image = function(file_path) local cmd = clipoard.get_clip_cmd() -- Windows - if cmd == "powershell" then + if cmd == "powershell.exe" then local command = string.format([[[System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes('%s'))]], file_path) local output, exit_code = util.execute(command) if exit_code == 0 then diff --git a/lua/img-clip/util.lua b/lua/img-clip/util.lua index 248118b..a20dbd9 100644 --- a/lua/img-clip/util.lua +++ b/lua/img-clip/util.lua @@ -22,8 +22,11 @@ M.execute = function(input_cmd) -- WSL requires the command to have the format: -- powershell.exe -Command 'command "path/to/file"' elseif M.has("wsl") then - cmd = "powershell.exe -NoProfile -Command '" .. input_cmd:gsub("'", '"') .. "'" - + if input_cmd:match("curl") then + cmd = input_cmd + else + cmd = "powershell.exe -NoProfile -Command '" .. input_cmd:gsub("'", '"') .. "'" + end -- cmd.exe requires the command to have the format: -- powershell.exe -Command "command 'path/to/file'" elseif M.has("win32") then