xep_0027: Ensure data is a str before handling it

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
j 2023-01-26 17:32:23 +01:00 committed by Maxime “pep” Buquet
parent 80a89061f1
commit 4a6064772c
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -19,6 +19,8 @@ def _extract_data(data, kind):
stripped = [] stripped = []
begin_headers = False begin_headers = False
begin_data = False begin_data = False
if isinstance(data, bytes):
data = data.decode()
for line in data.split('\n'): for line in data.split('\n'):
if not begin_headers and 'BEGIN PGP %s' % kind in line: if not begin_headers and 'BEGIN PGP %s' % kind in line:
begin_headers = True begin_headers = True