Skip to content

Commit cd28994

Browse files
committed
Resolve dictionary key override
Key "dictkey_desc" was defined twice, such that places expecting a "description" instead received "descender". Added a different key, "dictkey_descr" with a string value of "description".
1 parent dfed029 commit cd28994

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

docs/document.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,21 +1551,19 @@ For details on **embedded files** refer to Appendix 3.
15511551
:rtype: dict
15521552
:returns: a dictionary with the following keys:
15531553

1554-
* *name* -- (*str*) name under which this entry is stored
1555-
* *filename* -- (*str*) filename
1556-
* *ufilename* -- (*unicode*) filename
1557-
* *desc* -- (*str*) description
1558-
* *size* -- (*int*) original file size
1559-
* *length* -- (*int*) compressed file length
1560-
* *creationDate* -- *(New in v1.18.13)* (*str*) date-time of item creation in PDF format
1561-
* *modDate* -- *(New in v1.18.13)* (*str*) date-time of last change in PDF format
1562-
* *collection* -- *(New in v1.18.13)* (*int*) :data:`xref` of the associated PDF portfolio item if any, else zero.
1563-
* *checksum* -- *(New in v1.18.13)* (*str*) a hashcode of the stored file content as a hexadecimal string. Should be MD5 according to PDF specifications, but be prepared to see other hashing algorithms.
1554+
* ``name`` -- (*str*) name under which this entry is stored
1555+
* ``filename`` -- (*str*) filename
1556+
* ``ufilename`` -- (*unicode*) filename
1557+
* ``description`` -- (*str*) description
1558+
* ``size`` -- (*int*) original file size
1559+
* ``length`` -- (*int*) compressed file length
1560+
* ``creationDate`` -- (*str*) date-time of item creation in PDF format
1561+
* ``modDate`` -- (*str*) date-time of last change in PDF format
1562+
* ``collection`` -- (*int*) :data:`xref` of the associated PDF portfolio item if any, else zero.
1563+
* ``checksum`` -- (*str*) a hashcode of the stored file content as a hexadecimal string. Should be MD5 according to PDF specifications, but be prepared to see other hashing algorithms.
15641564

15651565
.. method:: embfile_names()
15661566

1567-
* New in v1.14.16
1568-
15691567
PDF only: Return a list of embedded file names. The sequence of the names equals the physical sequence in the document.
15701568

15711569
:rtype: list

src/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ def file_info(self):
912912
size = mupdf.pdf_to_int(o)
913913

914914
res[ dictkey_filename] = JM_EscapeStrFromStr(filename)
915-
res[ dictkey_desc] = JM_UnicodeFromStr(desc)
915+
res[ dictkey_descr] = JM_UnicodeFromStr(desc)
916916
res[ dictkey_length] = length
917917
res[ dictkey_size] = size
918918
return res
@@ -3255,7 +3255,7 @@ def _embfile_info(self, idx, infodict):
32553255
infodict[dictkey_ufilename] = JM_EscapeStrFromStr(name)
32563256

32573257
name = mupdf.pdf_to_text_string(mupdf.pdf_dict_get(o, PDF_NAME('Desc')))
3258-
infodict[dictkey_desc] = JM_UnicodeFromStr(name)
3258+
infodict[dictkey_descr] = JM_UnicodeFromStr(name)
32593259

32603260
len_ = -1
32613261
DL = -1
@@ -13665,7 +13665,7 @@ class EmptyFileError(FileDataError):
1366513665
dictkey_cs_name = "cs-name"
1366613666
dictkey_da = "da"
1366713667
dictkey_dashes = "dashes"
13668-
dictkey_desc = "desc"
13668+
dictkey_descr = "description"
1366913669
dictkey_desc = "descender"
1367013670
dictkey_dir = "dir"
1367113671
dictkey_effect = "effect"

0 commit comments

Comments
 (0)