From 8fe6b7cb608cd1d8d77587c919463158eeafe220 Mon Sep 17 00:00:00 2001 From: MobiDev Date: Sun, 11 Jun 2023 17:54:49 +0100 Subject: [PATCH] fix fatal search error when manifest is malformed (#144) --- wally-registry-backend/src/search.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wally-registry-backend/src/search.rs b/wally-registry-backend/src/search.rs index 7014279f..02917c25 100644 --- a/wally-registry-backend/src/search.rs +++ b/wally-registry-backend/src/search.rs @@ -142,8 +142,10 @@ impl SearchBackend { for (_score, doc_address) in top_docs { let retrieved_doc = searcher.doc(doc_address)?; let retrieved_doc = self.schema.to_json(&retrieved_doc); - let retrieved_doc: NativeDocResult = serde_json::from_str(&retrieved_doc)?; - + let retrieved_doc: NativeDocResult = match serde_json::from_str(&retrieved_doc) { + Ok(doc) => doc, + Err(_) => continue, + }; docs.push(DocResult { scope: retrieved_doc.scope[0].clone(), name: retrieved_doc.name[0].clone(),