#540 Fix shell escaping pretty much everywhere

This commit is contained in:
w0rp 2017-05-08 22:59:25 +01:00
parent 28c6ec9cad
commit 6ea00af689
37 changed files with 85 additions and 87 deletions

View file

@ -41,14 +41,13 @@ endfunction
function! s:BuildClassPathOption(buffer, import_paths) abort
" Filter out lines like [INFO], etc.
let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''')
call map(l:class_paths, 'fnameescape(v:val)')
call extend(
\ l:class_paths,
\ split(ale#Var(a:buffer, 'java_javac_classpath'), s:classpath_sep),
\)
return !empty(l:class_paths)
\ ? '-cp ' . join(l:class_paths, s:classpath_sep)
\ ? '-cp ' . shellescape(join(l:class_paths, s:classpath_sep))
\ : ''
endfunction
@ -65,7 +64,7 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
if !empty(l:src_dir)
let l:sp_option = '-sourcepath ' . fnameescape(l:src_dir)
let l:sp_option = '-sourcepath ' . shellescape(l:src_dir)
endif
" Create .class files in a temporary directory, which we will delete later.
@ -74,7 +73,7 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
return 'javac -Xlint'
\ . ' ' . l:cp_option
\ . ' ' . l:sp_option
\ . ' -d ' . fnameescape(l:class_file_directory)
\ . ' -d ' . shellescape(l:class_file_directory)
\ . ' ' . ale#Var(a:buffer, 'java_javac_options')
\ . ' %t'
endfunction