@@ -8206,7 +8206,8 @@ class AddOrUpdateDocumentParameters {
82068206
82078207 constructor ( content , contentType , path , tags ) {
82088208 if ( content ) {
8209- this . content = btoa ( content ) ;
8209+ // this.content = btoa(content);
8210+ this . content = content ;
82108211 }
82118212 if ( contentType ) {
82128213 this . contentType = contentType ;
@@ -8224,8 +8225,8 @@ class AddOrUpdateDocumentParameters {
82248225 this . documents . push ( document ) ;
82258226 }
82268227
8227- addAttachment ( tags ) {
8228- const document = new AddOrUpdateDocumentParameters ( null , null , null , tags ) ;
8228+ addAttachment ( path , tags ) {
8229+ const document = new AddOrUpdateDocumentParameters ( null , null , path , tags ) ;
82298230 this . documents . push ( document ) ;
82308231 }
82318232
@@ -8369,11 +8370,25 @@ class WebFormsHandler {
83698370 }
83708371 } ) ;
83718372 const content = JSON . stringify ( data ) ;
8372- const addOrUpdateDocumentParameters = this . documentsApi . buildDocumentParametersForAddOrUpdate ( content ) ;
8373+ const tags = [ ] ;
8374+ if ( data . formName ) {
8375+ tags . push (
8376+ {
8377+ key : 'webformName' ,
8378+ value : JSON . stringify ( data . formName ) . replace ( / \" / g, '' )
8379+ }
8380+ ) ;
8381+ }
8382+ let path = null ;
8383+ if ( window . location . href ) {
8384+ path = window . location . href ;
8385+ }
8386+ const addOrUpdateDocumentParameters = this . documentsApi . buildDocumentParametersForAddOrUpdate ( content , 'application/json' , path , tags ) ;
83738387 const fileInputElements = Array . from ( fkqFormElement . getElementsByTagName ( 'INPUT' ) ) . filter ( ( input ) => input . type === 'file' ) ;
83748388 fileInputElements . forEach ( ( fileInputElement ) => {
83758389 if ( fileInputElement . value ) {
8376- addOrUpdateDocumentParameters . addAttachment ( [ this . documentsApi . buildDocumentTagParametersForAdd ( 'fieldName' , fileInputElement . getAttribute ( 'name' ) ) ] ) ;
8390+ const path = fileInputElement . value . replace ( 'C:\\fakepath\\' , '' ) ;
8391+ addOrUpdateDocumentParameters . addAttachment ( path , [ this . documentsApi . buildDocumentTagParametersForAdd ( 'fieldName' , fileInputElement . getAttribute ( 'name' ) ) ] ) ;
83778392 }
83788393 } ) ;
83798394 const response = await this . sendFormRequests ( addOrUpdateDocumentParameters , fileInputElements ) ;
0 commit comments