From 89e77bc2931e3db9bd2ff58439147e8874a5bed0 Mon Sep 17 00:00:00 2001
From: Jayaprakash8887 <Jayaprakash.narayanaswamy@tarento.com>
Date: Wed, 15 Jun 2022 19:05:13 +0530
Subject: [PATCH] Issue #SB-30307 fix: relational_metadata setting as string
 null

---
 .../main/scala/org/sunbird/content/actors/ContentActor.scala | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/content-api/content-actors/src/main/scala/org/sunbird/content/actors/ContentActor.scala b/content-api/content-actors/src/main/scala/org/sunbird/content/actors/ContentActor.scala
index 16ebcc64d..fabc95d43 100644
--- a/content-api/content-actors/src/main/scala/org/sunbird/content/actors/ContentActor.scala
+++ b/content-api/content-actors/src/main/scala/org/sunbird/content/actors/ContentActor.scala
@@ -243,6 +243,11 @@ class ContentActor @Inject() (implicit oec: OntologyEngineContext, ss: StorageSe
 		"Yes".equalsIgnoreCase(node.getMetadata.getOrDefault("trackable", new java.util.HashMap[String, AnyRef]).asInstanceOf[java.util.Map[String, AnyRef]].getOrDefault("enabled", "").asInstanceOf[String])) {
 			node.getMetadata.put("contentType", "Course")
 		}
+
+		//TODO: Below fix to be reviewed when the fix for null to Stringify in ExternalStore.scala is implemented
+		if(node.getExternalData != null && node.getExternalData.containsKey("relational_metadata") && node.getExternalData.get("relational_metadata") == null) {
+			node.getExternalData.put("relational_metadata", "{}")
+		}
 		node
 	}
 
-- 
GitLab