Merge pull request #223 from paulkaplan/fix-broken-say-xml

Escape xml before putting user text into text bubble
This commit is contained in:
Paul Kaplan 2018-01-10 09:20:06 -05:00 committed by GitHub
commit f5a638367f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -46,6 +46,7 @@
"travis-after-all": "^1.4.4",
"twgl.js": "3.7.0",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.8.2"
"webpack-dev-server": "^2.8.2",
"xml-escape": "1.1.0"
}
}

View File

@ -1,5 +1,6 @@
const SVGTextWrapper = require('./svg-text-wrapper');
const SVGRenderer = require('../svg-quirks-mode/svg-renderer');
const xmlescape = require('xml-escape');
const MAX_LINE_LENGTH = 170;
const MIN_WIDTH = 50;
@ -148,7 +149,7 @@ class SVGTextBubble {
}
_textFragment () {
return `<text fill="#575E75">${this.lines.join('\n')}</text>`;
return `<text fill="#575E75">${xmlescape(this.lines.join('\n'))}</text>`;
}
buildString (type, text, pointsLeft) {