Skip to content

Commit 31ce953

Browse files
author
Zhang
committed
fix: remove response factory auto escape xml character behavior.
Hot fix: this commit removes the auto-escape xml character behavior that might cause valid ssml tags to be escaped as well. Keeping the util function for developer to opt-in to use.
1 parent 5923afa commit 31ce953

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

ask-sdk-core/lib/response/ResponseFactory.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
Response,
2121
ui,
2222
} from 'ask-sdk-model';
23-
import { escapeXmlCharacters } from '../util/SsmlUtils';
2423
import { ResponseBuilder } from './ResponseBuilder';
2524
import Stream = interfaces.audioplayer.Stream;
2625
import AudioItem = interfaces.audioplayer.AudioItem;
@@ -80,7 +79,7 @@ export class ResponseFactory {
8079
response.outputSpeech = {
8180
type : 'SSML',
8281
ssml : '<speak>'
83-
+ escapeXmlCharacters(trimOutputSpeech(speechOutput))
82+
+ trimOutputSpeech(speechOutput)
8483
+ '</speak>',
8584
playBehavior,
8685
};
@@ -96,7 +95,7 @@ export class ResponseFactory {
9695
outputSpeech : {
9796
type : 'SSML',
9897
ssml : '<speak>'
99-
+ escapeXmlCharacters(trimOutputSpeech(repromptSpeechOutput))
98+
+ trimOutputSpeech(repromptSpeechOutput)
10099
+ '</speak>',
101100
playBehavior,
102101
},

ask-sdk-core/tst/response/ResponseFactory.spec.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -118,26 +118,6 @@ describe('ResponseFactory', () => {
118118
expect(responseBuilder.reprompt(speechOutput, 'ENQUEUE').getResponse()).to.deep.equal(expectResponse);
119119
});
120120

121-
it('should auto-escape invalid ssml character', () => {
122-
const responseBuilder : ResponseBuilder = ResponseFactory.init();
123-
const speechOutput = 'Hello World & Happy New Year!';
124-
const expectResponse = {
125-
outputSpeech: {
126-
ssml: '<speak>' + `Hello World &amp; Happy New Year!` + '</speak>',
127-
type: 'SSML',
128-
},
129-
reprompt : {
130-
outputSpeech : {
131-
ssml: '<speak>' + `Hello World &amp; Happy New Year!` + '</speak>',
132-
type: 'SSML',
133-
},
134-
},
135-
shouldEndSession : false,
136-
};
137-
138-
expect(responseBuilder.speak(speechOutput).reprompt(speechOutput).getResponse()).to.deep.equal(expectResponse);
139-
});
140-
141121
it('should build response with simple card', () => {
142122
const responseBuilder : ResponseBuilder = ResponseFactory.init();
143123
const cardTitle = 'Card Title';

0 commit comments

Comments
 (0)