mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-05-16 16:30:43 -04:00
Escape field values for XML-unsafe characters (#177)
* Escape field values for XML-unsafe characters * String equality check ===
This commit is contained in:
parent
08b40b4d1d
commit
6b08b95b97
2 changed files with 27 additions and 1 deletions
src/engine
|
@ -1,4 +1,5 @@
|
|||
var adapter = require('./adapter');
|
||||
var xmlEscape = require('../util/xml-escape');
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
|
@ -369,8 +370,12 @@ Blocks.prototype.blockToXML = function (blockId) {
|
|||
// Add any fields on this block.
|
||||
for (var field in block.fields) {
|
||||
var blockField = block.fields[field];
|
||||
var value = blockField.value;
|
||||
if (typeof value === 'string') {
|
||||
value = xmlEscape(blockField.value);
|
||||
}
|
||||
xmlString += '<field name="' + blockField.name + '">' +
|
||||
blockField.value + '</field>';
|
||||
value + '</field>';
|
||||
}
|
||||
// Add blocks connected to the next connection.
|
||||
if (block.next) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue