From 4aa3ca5c169dbbef58d4b04f8809c8d70091b7c7 Mon Sep 17 00:00:00 2001 From: Tinmarino Date: Fri, 7 Aug 2020 12:20:59 -0400 Subject: [PATCH] Fix: VimwikiGenerateLinks crash with single quote in filename (Issue #886 #881) --- autoload/vimwiki/base.vim | 4 +++- doc/vimwiki.txt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 22a41aa..2529071 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -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:normalised_file_paths = \ 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 = - \ 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 endfunction diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 701e099..7fe36d7 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -3766,6 +3766,7 @@ Changed:~ Removed:~ Fixed:~ + * Issue #886: VimwikiGenerateLinks crash with single quote in filename * Issue #910: Fix: VimwikiTOC removes next non-empty line * Issue #182: VimwikiTOC support headers with link * Issue #813: iMap interfere with completion (pum)