From 1d326f880813a39d977afdc811de04b775b20c1c Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Mon, 27 May 2013 07:46:54 +0000 Subject: [PATCH] GnuPG only *sometimes* returns the filename for the plaintext. * We can't split twice at first, because sometimes there isn't a third field in the string. * There isn't any rhyme or reason to when the filename is present or missing. It just is. --- src/_parsers.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/_parsers.py b/src/_parsers.py index df557fb..44dad8d 100644 --- a/src/_parsers.py +++ b/src/_parsers.py @@ -1139,10 +1139,14 @@ class Crypt(Verify): elif key == "SIGEXPIRED": self.status = 'sig expired' elif key == "PLAINTEXT": - fmt, self.data_timestamp, self.data_filename = value.split(' ', 2) - ## GnuPG give us a hex byte for an ascii char corresponding to - ## the data format of the resulting plaintext, - ## i.e. '62'→'b':= binary data + fmt, dts = value.split(' ', 1) + if dts.find(' ') > 0: + self.data_timestamp, self.data_filename = dts.split(' ', 1) + else: + self.data_timestamp = dts + ## GnuPG give us a hex byte for an ascii char corresponding to + ## the data format of the resulting plaintext, + ## i.e. '62'→'b':= binary data self.data_format = chr(int(str(fmt), 16)) else: Verify.handle_status(key, value)