Skip to content

Commit bdb5e91

Browse files
authored
Merge pull request #164 from souljorje/fix/xss-vulnerability-1.x
fix: xss vulnerability
2 parents 6760219 + 48ce265 commit bdb5e91

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/components/TreeNode/index.vue

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
@click="onBracketsClick"
3434
/>
3535

36-
<span v-else :class="valueClass" v-html="valueFormatter(node.content)" />
36+
<span v-else-if="customValueFormatter" v-html="customFormatter(node.content)"></span>
37+
<span v-else :class="valueClass" v-text="defaultFormatter(node.content)" />
3738

3839
<span v-if="showLength && collapsed" class="vjs-comment"> // {{ node.length }} items </span>
3940
</span>
@@ -131,18 +132,16 @@ export default {
131132
defaultFormatter(data) {
132133
let text = data + '';
133134
if (this.dataType === 'string') text = `"${text}"`;
134-
return text;
135-
},
136-
137-
valueFormatter(data) {
138-
const basic = this.customValueFormatter
139-
? this.customValueFormatter(
140-
data,
141-
this.node.key,
142-
this.node.path,
143-
this.defaultFormatter(data),
144-
)
145-
: this.defaultFormatter(data);
135+
return this.node.showComma ? `${text},` : text;
136+
},
137+
138+
customFormatter(data) {
139+
const basic = this.customValueFormatter(
140+
data,
141+
this.node.key,
142+
this.node.path,
143+
this.defaultFormatter(data),
144+
);
146145
147146
return this.node.showComma ? `${basic},` : basic;
148147
},

0 commit comments

Comments
 (0)