Skip to content

Commit

Permalink
pdfdocument: per dumppdf.py, get_dest accepts either bytes or str
Browse files Browse the repository at this point in the history
  • Loading branch information
0xabu committed Sep 3, 2021
1 parent 43701e1 commit 4a83166
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pdfminer/pdfdocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import re
import struct
from hashlib import sha256, md5
from typing import (Any, Dict, Iterable, Iterator, KeysView, List, Optional,
Sequence, Tuple, Type, cast)
from typing import (Any, AnyStr, Dict, Iterable, Iterator, KeysView, List,
Optional, Sequence, Tuple, Type, Union, cast)

from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
Expand Down Expand Up @@ -773,7 +773,7 @@ def search(entry: Any, level: int
return
return search(self.catalog['Outlines'], 0)

def lookup_name(self, cat: str, key: str) -> Any:
def lookup_name(self, cat: str, key: Union[str, bytes]) -> Any:
try:
names = dict_value(self.catalog['Names'])
except (PDFTypeError, KeyError):
Expand All @@ -798,7 +798,7 @@ def lookup(d: Dict[str, Any]) -> Any:
raise KeyError((cat, key))
return lookup(d0)

def get_dest(self, name: str) -> Any:
def get_dest(self, name: Union[str, bytes]) -> Any:
try:
# PDF-1.2 or later
obj = self.lookup_name('Dests', name)
Expand Down

0 comments on commit 4a83166

Please sign in to comment.