Skip to content

Commit 57baa9b

Browse files
committed
fix guid parsing in jsonfeed reader
1 parent f273daa commit 57baa9b

3 files changed

Lines changed: 4 additions & 8 deletions

File tree

commonmeta/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"""
1111

1212
__title__ = "commonmeta-py"
13-
__version__ = "0.222"
13+
__version__ = "0.223"
1414
__author__ = "Martin Fenner"
1515
__license__ = "MIT"
1616

commonmeta/readers/jsonfeed_reader.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,9 @@ def read_jsonfeed(data: dict | None, **kwargs) -> Commonmeta:
8181
# Generate DOI from guid if it is a DOI string
8282
if _id is None and dig(meta, "blog.prefix") and meta.get("guid", None):
8383
prefix = dig(meta, "blog.prefix")
84-
guid = meta.get("guid", None)
84+
guid = str(meta.get("guid"))
8585

86-
if (
87-
guid is not None
88-
and len(guid) > 2
89-
and validate_doi_from_guid(prefix, guid[:-2], checksum=False)
90-
):
86+
if len(guid) > 2 and validate_doi_from_guid(prefix, guid[:-2], checksum=False):
9187
_id = guid
9288

9389
# If still no DOI but prefix provided

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)