mirror of
https://gitlab.com/nightlycommit/twing.git
synced 2025-01-18 08:46:50 +02:00
Merge branch 'issue-594' into '6.x'
Resolve issue #594 See merge request nightlycommit/twing!587
This commit is contained in:
commit
83cc625cf0
@ -34,7 +34,7 @@ export const createCheckToStringNode = (
|
||||
.then((value) => {
|
||||
if (sandboxed) {
|
||||
const assertToStringAllowed = getTraceableMethod((value: any) => {
|
||||
if (typeof value === 'object') {
|
||||
if ((value !== null) && (typeof value === 'object')) {
|
||||
try {
|
||||
template.checkMethodAllowed(value, 'toString');
|
||||
} catch (error) {
|
||||
|
@ -3,5 +3,6 @@ import "./when-enabled";
|
||||
import "./with-filter";
|
||||
import "./with-function";
|
||||
import "./with-method";
|
||||
import "./with-missing-variable";
|
||||
import "./with-property";
|
||||
import "./with-tag";
|
||||
|
25
test/tests/integration/sandboxing/with-missing-variable.ts
Normal file
25
test/tests/integration/sandboxing/with-missing-variable.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import {runTest} from "../TestBase";
|
||||
|
||||
runTest({
|
||||
description: '"sandbox" tag with missing variable',
|
||||
templates: {
|
||||
"index.twig": `{{ foo }}`
|
||||
},
|
||||
environmentOptions: {
|
||||
sandboxed: true,
|
||||
strictVariables: false
|
||||
},
|
||||
expectation: ''
|
||||
});
|
||||
|
||||
runTest({
|
||||
description: '"sandbox" tag with missing variable',
|
||||
templates: {
|
||||
"index.twig": `{{ foo.bar() }}`
|
||||
},
|
||||
environmentOptions: {
|
||||
sandboxed: true,
|
||||
strictVariables: false
|
||||
},
|
||||
expectation: ''
|
||||
});
|
@ -9,4 +9,5 @@ import "./not_valid2";
|
||||
import "./range_operator";
|
||||
import "./simple";
|
||||
import "./with-embed-tag";
|
||||
import "./with-missing-variable";
|
||||
import "./within-a-sandboxed-environment";
|
||||
|
16
test/tests/integration/tags/sandbox/with-missing-variable.ts
Normal file
16
test/tests/integration/tags/sandbox/with-missing-variable.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import {runTest} from "../../TestBase";
|
||||
|
||||
runTest({
|
||||
description: '"sandbox" tag with missing variable',
|
||||
templates: {
|
||||
"index.twig": `{% sandbox %}
|
||||
{% include "foo.twig" %}
|
||||
{% endsandbox %}
|
||||
`,
|
||||
'foo.twig': `{{ foo }}`
|
||||
},
|
||||
environmentOptions: {
|
||||
strictVariables: false
|
||||
},
|
||||
expectation: ''
|
||||
});
|
Loading…
Reference in New Issue
Block a user