From e0bf829def15ecd0e9f549e89ae0c0457b5852e4 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Tue, 1 Feb 2022 20:19:14 +0100 Subject: [PATCH] Bugfix parsing /Keywords' in doc_info of pdf file with type bytes (fixes #2302) --- cps/uploader.py | 5 ++++- optional-requirements.txt | 2 +- setup.cfg | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cps/uploader.py b/cps/uploader.py index f238b89d..992d188c 100644 --- a/cps/uploader.py +++ b/cps/uploader.py @@ -233,7 +233,10 @@ def pdf_meta(tmp_file_path, original_file_name, original_file_extension): if subject == '': subject = doc_info.subject if tags == '' and '/Keywords' in doc_info: - tags = doc_info['/Keywords'] + if isinstance(doc_info['/Keywords'], bytes): + tags = doc_info['/Keywords'].decode('utf-8') + else: + tags = doc_info['/Keywords'] else: title = original_file_name diff --git a/optional-requirements.txt b/optional-requirements.txt index 2ebcf1a7..f894fcc1 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -33,7 +33,7 @@ rarfile>=2.7 scholarly>=1.2.0,<1.6 # Comics -natsort>=2.2.0,<8.1.0 +natsort>=2.2.0,<8.2.0 comicapi>=2.2.0,<2.3.0 # Kobo integration diff --git a/setup.cfg b/setup.cfg index db2fd3e6..d17642dd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -87,7 +87,7 @@ metadata = rarfile>=2.7 scholarly>=1.2.0,<1.6 comics = - natsort>=2.2.0,<8.1.0 + natsort>=2.2.0,<8.2.0 comicapi>=2.2.0,<2.3.0 kobo = jsonschema>=3.2.0,<4.5.0