From 9e69ba79bee28dddee5d59e3986d4fb37ae64109 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 6 Aug 2018 23:01:58 -0400 Subject: [PATCH] Detect armored files by checking for an armor header line Closes jamessan/vim-gnupg#82 Signed-off-by: James McCoy --- plugin/gnupg.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index da5768e..bf83468 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -1,5 +1,5 @@ " Name: gnupg.vim -" Last Change: 2018 Jun 22 +" Last Change: 2018 Aug 06 " Maintainer: James McCoy " Original Author: Markus Braun " Summary: Vim plugin for transparent editing of gpg encrypted files. @@ -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