From 141946444f091ed168c04d25188c296af17b5f8f Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 6 Jul 2024 04:09:14 +0200 Subject: [PATCH] fix(apb): parsing links without href --- apb/src/node.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apb/src/node.rs b/apb/src/node.rs index f83e2959..58e8a451 100644 --- a/apb/src/node.rs +++ b/apb/src/node.rs @@ -213,6 +213,7 @@ impl From<&str> for Node { #[cfg(feature = "unstructured")] impl From for Node { fn from(value: serde_json::Value) -> Self { + use crate::Link; match value { serde_json::Value::String(uri) => Node::Link(Box::new(uri)), serde_json::Value::Array(arr) => Node::Array( @@ -221,9 +222,9 @@ impl From for Node { .map(Node::from) ) ), - serde_json::Value::Object(_) => match value.get("href") { - None => Node::Object(Box::new(value)), - Some(_) => Node::Link(Box::new(value)), + serde_json::Value::Object(_) => match value.link_type() { + Ok(_) => Node::Link(Box::new(value)), + Err(_) => Node::Object(Box::new(value)), }, _ => Node::Empty, }