File tree Expand file tree Collapse file tree
src/main/java/com/hubspot/jinjava/tree/output Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .hubspot .jinjava .tree .output ;
22
3+ import com .hubspot .jinjava .JinjavaConfig ;
34import com .hubspot .jinjava .interpret .JinjavaInterpreter ;
45import com .hubspot .jinjava .interpret .OutputTooBigException ;
56import com .hubspot .jinjava .interpret .TemplateError ;
89import java .util .List ;
910
1011public class OutputList {
12+ public static final String PREVENT_ACCIDENTAL_EXPRESSIONS =
13+ "PREVENT_ACCIDENTAL_EXPRESSIONS" ;
1114 private final List <OutputNode > nodes = new LinkedList <>();
1215 private final List <BlockPlaceholderOutputNode > blocks = new LinkedList <>();
1316 private final long maxOutputSize ;
@@ -46,6 +49,16 @@ public List<BlockPlaceholderOutputNode> getBlocks() {
4649 }
4750
4851 public String getValue () {
52+ boolean preventAccidentalExpressions = JinjavaInterpreter
53+ .getCurrentMaybe ()
54+ .map (JinjavaInterpreter ::getConfig )
55+ .map (JinjavaConfig ::getFeatures )
56+ .map (
57+ features ->
58+ features .getActivationStrategy (PREVENT_ACCIDENTAL_EXPRESSIONS ).isActive (null )
59+ )
60+ .orElse (false );
61+
4962 LengthLimitingStringBuilder val = new LengthLimitingStringBuilder (maxOutputSize );
5063
5164 for (OutputNode node : nodes ) {
You can’t perform that action at this time.
0 commit comments