Commit f840ef0d authored by HiPhish's avatar HiPhish
Browse files

Escape file names when using them in a command

If a file name contains a special character like `%` and we construct a
command for use with `:execute`, that special character will get
expanded.  We need to escape all file names first.
parent 51b8a2a5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ augroup END
function! s:extension(fname)
	" This will fail setting the file type of unknown file extension like
	" 'foo.nonsense.jinja', which is what we want.
	noautocmd exe 'file ' .. fnamemodify(a:fname, ':r')
	noautocmd silent exe 'file' fnameescape(fnamemodify(a:fname, ':r'))
	filetype detect

	" Now that we have detected the parent file type we can append Jinja to it
@@ -39,5 +39,5 @@ function! s:extension(fname)
		set filetype+=.jinja
	endif

	exe 'noautocmd file ' .. a:fname
	silent exe 'noautocmd' 'file' fnameescape(a:fname)
endfunction