Skip to content

Commit a37c8f7

Browse files
Vikram KaltaVikram Kalta
authored andcommitted
fix: wrapped img tag with a tag
1 parent 748e229 commit a37c8f7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.contentstack.sdk</groupId>
66
<artifactId>utils</artifactId>
7-
<version>1.2.6</version>
7+
<version>1.2.7</version>
88
<packaging>jar</packaging>
99
<name>Contentstack-utils</name>
1010
<description>Java Utils SDK for Contentstack Content Delivery API, Contentstack is a headless CMS</description>

src/main/java/com/contentstack/utils/render/DefaultOption.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public String renderNode(String nodeType, JSONObject nodeObject, NodeCallback ca
109109
case "img":
110110
String assetLink = getNodeStr(nodeObject, "asset-link");
111111
if (!assetLink.isEmpty()) {
112+
JSONObject attrs = nodeObject.optJSONObject("attrs");
113+
if (attrs.has("link")) {
114+
return "<a href=\"" + escapeInjectHtml(nodeObject, "link") + "\" />" + "<img" + strAttrs + " src=\"" + escapeInjectHtml(nodeObject, "asset-link") + "\" />" + children + "</a>";
115+
}
112116
return "<img" + strAttrs + " src=\"" + escapeInjectHtml(nodeObject, "asset-link") + "\" />" + children;
113117
}
114118
return "<img" + strAttrs + " src=\"" + escapeInjectHtml(nodeObject, "src") + "\" />" + children;

0 commit comments

Comments
 (0)