Skip to content

Commit

Permalink
Detect armored files by checking for an armor header line
Browse files Browse the repository at this point in the history
Closes #82
Signed-off-by: James McCoy <jamessan@jamessan.com>
  • Loading branch information
jamessan committed Aug 7, 2018
1 parent 7fcea1a commit 9e69ba7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/gnupg.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
" Name: gnupg.vim
" Last Change: 2018 Jun 22
" Last Change: 2018 Aug 06
" Maintainer: James McCoy <jamessan@jamessan.com>
" Original Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files.
Expand Down Expand Up @@ -590,7 +590,7 @@ function s:GPGDecrypt(bufread)

if b:GPGEncrypted
" check if the message is armored
if (match(output, "gpg: armor header") >= 0)
if readfile(filename, '', 1)[0] =~# '^-\{5}BEGIN PGP\%( SIGNED\)\= MESSAGE-\{5}$'
call s:GPGDebug(1, "this file is armored")
let b:GPGOptions += ["armor"]
endif
Expand Down

0 comments on commit 9e69ba7

Please sign in to comment.