From 97cbb42f24ef8836c2d7738e60d67515384c3f7c Mon Sep 17 00:00:00 2001 From: moxie Date: Sun, 15 Mar 2026 13:21:28 +0200 Subject: fix(utils): resolve relative paths correctly --- lua/muwiki/utils.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lua/muwiki/utils.lua') diff --git a/lua/muwiki/utils.lua b/lua/muwiki/utils.lua index bc6094e..273a466 100644 --- a/lua/muwiki/utils.lua +++ b/lua/muwiki/utils.lua @@ -60,9 +60,11 @@ end function M.resolve(filepath, wiki_root) local path = filepath:gsub('^file://', '') local path_type = path:sub(1, 1) - if path_type ~= '/' and path_type ~= '~' then - local base = wiki_root and vim.fs.dirname(wiki_root) - or vim.fs.dirname(vim.api.nvim_buf_get_name(0)) + if path_type == '.' then + local current_dir = vim.fs.dirname(vim.api.nvim_buf_get_name(0)) + path = vim.fs.joinpath(current_dir, path) + elseif path_type ~= '/' and path_type ~= '~' then + local base = wiki_root or vim.fs.dirname(vim.api.nvim_buf_get_name(0)) path = vim.fs.joinpath(base, path) end return vim.fs.normalize(path) -- cgit v1.2.3