Fix: VimwikiGenerateLinks crash with single quote in filename (Issue #886 #881)

This commit is contained in:
Tinmarino 2020-08-07 12:20:59 -04:00
parent dd239c58fb
commit 4aa3ca5c16
2 changed files with 4 additions and 1 deletions

View File

@ -2565,8 +2565,10 @@ function! vimwiki#base#is_diary_file(filename, ...) abort
let l:diary_file_paths = a:0 > 0 ? a:1 : vimwiki#diary#get_diary_files() let l:diary_file_paths = a:0 > 0 ? a:1 : vimwiki#diary#get_diary_files()
let l:normalised_file_paths = let l:normalised_file_paths =
\ map(l:diary_file_paths, 'vimwiki#path#normalize(v:val)') \ map(l:diary_file_paths, 'vimwiki#path#normalize(v:val)')
" Escape single quote (Issue #886)
let filename = substitute(a:filename, "'", "''", 'g')
let l:matching_files = let l:matching_files =
\ filter(l:normalised_file_paths, "v:val ==# '" . a:filename . "'" ) \ filter(l:normalised_file_paths, "v:val ==# '" . filename . "'" )
return len(l:matching_files) > 0 " filename is a diary file if match is found return len(l:matching_files) > 0 " filename is a diary file if match is found
endfunction endfunction

View File

@ -3766,6 +3766,7 @@ Changed:~
Removed:~ Removed:~
Fixed:~ Fixed:~
* Issue #886: VimwikiGenerateLinks crash with single quote in filename
* Issue #910: Fix: VimwikiTOC removes next non-empty line * Issue #910: Fix: VimwikiTOC removes next non-empty line
* Issue #182: VimwikiTOC support headers with link * Issue #182: VimwikiTOC support headers with link
* Issue #813: iMap <Cr> interfere with completion (pum) * Issue #813: iMap <Cr> interfere with completion (pum)