@@ -417,6 +417,35 @@ describe("SmartlingFileTranslationsApi class tests.", () => {
417417 assert . ok ( fileWithMetadata . fileContent . byteLength === 1 ) ;
418418 } ) ;
419419
420+ it ( "Download translated file with escaped quotes in the file name" , async ( ) => {
421+ const localeId = "de-DE" ;
422+
423+ getHeaderStub . onCall ( 0 ) . returns ( "application/xml" ) ;
424+ getHeaderStub . onCall ( 1 ) . returns ( "attachment; filename=\"test - \\\"phase 1\\\".xml\"" ) ;
425+ getHeaderStub . returns ( null ) ;
426+
427+ const fileWithMetadata = await fileTranslationsApi . downloadTranslatedFileWithMetadata (
428+ accountUid , fileUid , mtUid , localeId
429+ ) ;
430+
431+ sinon . assert . calledOnceWithExactly (
432+ fileTranslationsApiFetchStub ,
433+ `https://test.com/file-translations-api/v2/accounts/${ accountUid } /files/${ fileUid } /mt/${ mtUid } /locales/${ localeId } /file` ,
434+ {
435+ method : "get" ,
436+ headers : {
437+ Authorization : "test_token_type test_access_token" ,
438+ "Content-Type" : "application/json" ,
439+ "User-Agent" : userAgent
440+ }
441+ }
442+ ) ;
443+
444+ assert . ok ( fileWithMetadata . contentType === "application/xml" ) ;
445+ assert . ok ( fileWithMetadata . fileName === "test - \"phase 1\".xml" ) ;
446+ assert . ok ( fileWithMetadata . fileContent . byteLength === 1 ) ;
447+ } ) ;
448+
420449 it ( "Download translated files" , async ( ) => {
421450 await fileTranslationsApi . downloadTranslatedFiles ( accountUid , fileUid , mtUid ) ;
422451
0 commit comments