diff --git a/gnupg/_parsers.py b/gnupg/_parsers.py index e409afc..1c99c0d 100644 --- a/gnupg/_parsers.py +++ b/gnupg/_parsers.py @@ -298,7 +298,7 @@ def _sanitise(*args): values = value.split(' ') for v in values: ## these can be handled separately, without _fix_unsafe(), - ## because they are only allowed if the pass the regex + ## because they are only allowed if they pass the regex if (flag in none_options) and (v is None): continue @@ -332,8 +332,11 @@ def _sanitise(*args): if flag in ['--encrypt', '--encrypt-files', '--decrypt', '--decrypt-files', '--import', '--verify']: - if _util._is_file(val): checked += (val + " ") - else: log.debug("%s not file: %s" % (flag, val)) + if _util._is_file(val) or \ + (flag == '--verify' and val == '-'): + checked += (val + " ") + else: + log.debug("%s not file: %s" % (flag, val)) elif flag in ['--cipher-algo', '--personal-cipher-prefs', '--personal-cipher-preferences']: @@ -372,7 +375,8 @@ def _sanitise(*args): groups[last] = str(filo.pop()) ## accept the read-from-stdin arg: if len(filo) >= 1 and filo[len(filo)-1] == '-': - groups[last] += str(' - \'\'') ## gross hack + groups[last] += str(' - ') ## gross hack + filo.pop() else: groups[last] = str() while len(filo) > 1 and not is_flag(filo[len(filo)-1]): diff --git a/gnupg/gnupg.py b/gnupg/gnupg.py index 489e652..7d6fc30 100644 --- a/gnupg/gnupg.py +++ b/gnupg/gnupg.py @@ -308,7 +308,7 @@ class GPG(GPGBase): sig_fh = None try: sig_fh = open(sig_file) - args = ["--verify %s - " % sig_fh.name] + args = ["--verify %s -" % sig_fh.name] proc = self._open_subprocess(args) writer = _util._threaded_copy_data(file, proc.stdin) self._collect_output(proc, result, stdin=proc.stdin)