Skip to content

Commit

Permalink
Don't replace extension when copying a file (#105)
Browse files Browse the repository at this point in the history
* Don't replace extension when copying a file

* refactor: simplify logic

---------

Co-authored-by: Håkon Harnes <hakon@harnes.co>
  • Loading branch information
baroldgene and HakonHarnes authored Feb 23, 2025
1 parent b32e417 commit 0bb8b5c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/img-clip/paste.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ M.paste_image_from_path = function(src_path)
return true
end

local extension = config.get_opt("extension")
local extension = vim.fn.fnamemodify(src_path, ":e")
if extension == "" then
util.warn("File missing extension. Adding png.")
extension = config.get_opt("extension")
end

local file_path = fs.get_file_path(extension)
if not file_path then
util.error("Could not determine file path.")
Expand Down

0 comments on commit 0bb8b5c

Please sign in to comment.