If a link contains `.`, then this: fnamemodify(link_text, ':e') will return the last .-separated part of the name as extension, and nothing else will get appended. Instead, we check if the extension is empty _or_ doesn't match the extension for the target wiki, in which case we append the correct one. This seems like it works, and might not break anything else, given the branch of the function that it's in. Co-authored-by: Brennen Bearnes <code@p1k3.com>
This commit is contained in:
@@ -213,7 +213,6 @@ function! vimwiki#base#resolve_link(link_text, ...) abort
|
|||||||
let root_dir = fnamemodify(source_file, ':p:h') . '/'
|
let root_dir = fnamemodify(source_file, ':p:h') . '/'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
" Extract the other items depending on the scheme
|
" Extract the other items depending on the scheme
|
||||||
if link_infos.scheme =~# '\mwiki\d\+'
|
if link_infos.scheme =~# '\mwiki\d\+'
|
||||||
|
|
||||||
@@ -263,8 +262,10 @@ function! vimwiki#base#resolve_link(link_text, ...) abort
|
|||||||
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
" append extension iff one not already present or it's not the targeted
|
||||||
|
" wiki extension - https://github.com/vimwiki/vimwiki/issues/950
|
||||||
let ext = fnamemodify(link_text, ':e')
|
let ext = fnamemodify(link_text, ':e')
|
||||||
if ext ==? '' " append ext iff one not already present
|
if ext ==? '' || ext !=? vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -4055,6 +4055,7 @@ Changed:~
|
|||||||
Removed:~
|
Removed:~
|
||||||
|
|
||||||
Fixed:~
|
Fixed:~
|
||||||
|
* Issue #950: Correctly follow links containing .
|
||||||
* PR #1245 / issue #1244: Fix VimwikiBacklinks handling of bracketed links
|
* PR #1245 / issue #1244: Fix VimwikiBacklinks handling of bracketed links
|
||||||
* Issue #1193: Fix wildcard expansion in |find_autoload_file|
|
* Issue #1193: Fix wildcard expansion in |find_autoload_file|
|
||||||
* PR #1108: Fix resolution of leading-slash page links, add link tests
|
* PR #1108: Fix resolution of leading-slash page links, add link tests
|
||||||
|
|||||||
Reference in New Issue
Block a user