mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-06 11:52:10 +02:00
fix: handle missing time field in library API document/processing responses (#1028)
Documents and processing records without a stored time field caused a KeyError crash in get_documents and list_children. Use optional access so time resolves to None instead of failing.
This commit is contained in:
parent
cfbd5b9079
commit
08f69007c9
1 changed files with 3 additions and 3 deletions
|
|
@ -363,7 +363,7 @@ class Library:
|
|||
return [
|
||||
DocumentMetadata(
|
||||
id = v["id"],
|
||||
time = datetime.datetime.fromtimestamp(v["time"]),
|
||||
time = datetime.datetime.fromtimestamp(v["time"]) if "time" in v else None,
|
||||
kind = v["kind"],
|
||||
title = v.get("title", ""),
|
||||
comments = v.get("comments", ""),
|
||||
|
|
@ -678,7 +678,7 @@ class Library:
|
|||
ProcessingMetadata(
|
||||
id = v["id"],
|
||||
document_id = v["document-id"],
|
||||
time = datetime.datetime.fromtimestamp(v["time"]),
|
||||
time = datetime.datetime.fromtimestamp(v["time"]) if "time" in v else None,
|
||||
flow = v["flow"],
|
||||
collection = v["collection"],
|
||||
tags = v["tags"],
|
||||
|
|
@ -983,7 +983,7 @@ class Library:
|
|||
return [
|
||||
DocumentMetadata(
|
||||
id=v["id"],
|
||||
time=datetime.datetime.fromtimestamp(v["time"]),
|
||||
time=datetime.datetime.fromtimestamp(v["time"]) if "time" in v else None,
|
||||
kind=v["kind"],
|
||||
title=v["title"],
|
||||
comments=v.get("comments", ""),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue