Permalink
Browse files

Use filereadable() instead of glob() to detect whether a file exists.

glob() reports false positives if the filename has metacharacters in it
(e.g., "[...]"), which causes Vim to incorrectly open a new, blank
buffer instead of the specified file.

Closes jamessan/vim-gnupg#12

Signed-off-by: James McCoy <vega.james@gmail.com>
  • Loading branch information...
1 parent 15fd394 commit 6e9f52a160e3d15060848a8f453bd1b5bfa70db2 @nachoalonso nachoalonso committed with Sep 8, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 plugin/gnupg.vim
View
@@ -1,5 +1,5 @@
" Name: gnupg.vim
-" Last Change: 2013 Jun 14
+" Last Change: 2013 Sep 09
" Maintainer: James McCoy <vega.james@gmail.com>
" Original Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files.
@@ -404,7 +404,7 @@ function s:GPGDecrypt(bufread)
let b:GPGOptions = []
" File doesn't exist yet, so nothing to decrypt
- if empty(glob(filename))
+ if !filereadable(filename)
" Allow the user to define actions for GnuPG buffers
silent doautocmd User GnuPG
" call the autocommand for the file minus .gpg$

0 comments on commit 6e9f52a

Please sign in to comment.