Commits

Jason Hinch  committed 6cca81b

SOY-33: Modify Java implementation to be in line with js

  • Participants
  • Parent commits baa0580
  • Branches do_not_convert_existing_soy_data, issue/SOY-33 1
    1. issue/SOY-46

Comments (0)

Files changed (1)

File soy-template-plugin/src/main/java/com/atlassian/soy/impl/functions/GetTextAsHtmlFunction.java

     public SoyData computeForTofu(List<SoyData> args)
     {
         ArrayList <SoyData> escapedArgs = new ArrayList<SoyData>();
-        for(SoyData arg : args)
+        escapedArgs.add(args.get(0));
+        for(SoyData arg : args.subList(1, args.size()))
         {
             escapedArgs.add(StringData.forValue(Sanitizers.escapeHtml(arg)));
         }
-       return new SanitizedContent(getTextFunction.computeForTofu(
-           escapedArgs).stringValue(), SanitizedContent.ContentKind.HTML);
+
+        String html = getTextFunction.computeForTofu(
+                escapedArgs).stringValue();
+        // If the i18n key was resolved. Escape it just to be sure
+        if (html.equals(args.get(0).stringValue())) {
+            html = Sanitizers.escapeHtml(html);
+        }
+        return new SanitizedContent(html, SanitizedContent.ContentKind.HTML);
 
     }
 }