diff options
| author | moxie <moxie@3kgcat.fi> | 2026-03-15 13:21:28 +0200 |
|---|---|---|
| committer | moxie <moxie@3kgcat.fi> | 2026-03-15 13:51:05 +0200 |
| commit | 97cbb42f24ef8836c2d7738e60d67515384c3f7c (patch) | |
| tree | beecfc2935227f30b21201a201ca80eb959ec893 /lua/muwiki/links.lua | |
| parent | be3794da7602a78aec527750986c05d5bc8bd930 (diff) | |
fix(utils): resolve relative paths correctly
Diffstat (limited to 'lua/muwiki/links.lua')
| -rw-r--r-- | lua/muwiki/links.lua | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/lua/muwiki/links.lua b/lua/muwiki/links.lua index 599ddb8..3302f3b 100644 --- a/lua/muwiki/links.lua +++ b/lua/muwiki/links.lua @@ -78,28 +78,13 @@ function M.open_link() return end - local wiki_root = get_wiki_root() - if not wiki_root then - return - end - if link.type == 'file' then - if vim.startswith(link.target, 'file://') then - local file_path = utils.resolve(link.target, nil) - vim.system({ 'xdg-open', file_path }, { detach = true }) - else - local ok, file_path = pcall(utils.resolve, link.target, wiki_root) - if not ok then - vim.notify(string.format('Cannot resolve path: %s', link.target), vim.log.levels.ERROR) - return - end - - vim.system({ 'xdg-open', file_path }, { detach = true }) - end + local file_path = utils.resolve(link.target, nil) + vim.system({ 'xdg-open', file_path }, { detach = true }) return end - local file_path = utils.resolve(link.target, wiki_root) + local file_path = utils.resolve(link.target, nil) utils.open_in_buffer(file_path) end |
