Skip to content

Commit

Permalink
Bugfix parsing /Keywords' in doc_info of pdf file with type bytes (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OzzieIsaacs committed Feb 1, 2022
1 parent 95e0255 commit e0bf829
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cps/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion optional-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e0bf829

Please sign in to comment.