mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(image): do not save remote image if fetch fails (#1915)
## Description If fetching an image fails, when the buffer with the image is opened again, the error message shown is for the `identify` command rather than the `url` command. This is because the output of the `wget` or `curl` command is saved to the file even if the fetching fails. Thus, when we try to resolve it again, we think it's cached and read the file on the `identify` step only to fail. ## Related Issue(s) did not find any
This commit is contained in:
parent
fc06234ce1
commit
cb6bf052da
1 changed files with 3 additions and 0 deletions
|
|
@ -62,6 +62,9 @@ local commands = {
|
|||
local src = M.norm(ctx.src)
|
||||
return M.is_uri(src) and convert:tmpfile("data") or src
|
||||
end,
|
||||
on_error = function(step)
|
||||
vim.fs.rm(step.file)
|
||||
end,
|
||||
},
|
||||
typ = {
|
||||
ft = "pdf",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue