@@ -12,7 +12,7 @@ import {
1212 isWebfileContentLoadNeeded ,
1313 setFileContent ,
1414} from "../utilities/commonUtil" ;
15- import { getCustomRequestURL , getMappingEntityContent , getMappingEntityId , getRequestURL } from "../utilities/urlBuilderUtil" ;
15+ import { getCustomRequestURL , getMappingEntityContent , getMappingEntityId , getMimeType , getRequestURL } from "../utilities/urlBuilderUtil" ;
1616import { getCommonHeaders } from "../common/authenticationProvider" ;
1717import * as Constants from "../common/constants" ;
1818import { ERRORS , showErrorDialog } from "../common/errorHandler" ;
@@ -413,6 +413,7 @@ async function createFile(
413413 attribute
414414 ) ;
415415 let fileContent = Constants . NO_CONTENT ;
416+ let mimeType = undefined ;
416417 let mappingEntityId = null
417418 // By default content is preloaded for all the files except for non-text webfiles for V2
418419 const isPreloadedContent = mappingEntityFetchQuery ? isWebfileContentLoadNeeded ( fileNameWithExtension , fileUri ) : true ;
@@ -432,6 +433,7 @@ async function createFile(
432433 dataverseOrgUrl
433434 ) ;
434435 mappingEntityId = getMappingEntityId ( entityName , mappingContent ) ;
436+ mimeType = getMimeType ( mappingContent ) ;
435437 fileContent = getMappingEntityContent ( entityName , mappingContent , attribute ) ;
436438 } else {
437439 fileContent = GetFileContent ( result , attributePath , entityName , entityId ) ;
@@ -449,7 +451,7 @@ async function createFile(
449451 result [ attributePath . source ] ?? Constants . NO_CONTENT ,
450452 fileExtension ,
451453 result [ Constants . ODATA_ETAG ] ,
452- result [ Constants . MIMETYPE ] ,
454+ mimeType ?? result [ Constants . MIMETYPE ] ,
453455 isPreloadedContent ,
454456 mappingEntityId
455457 ) ;
@@ -513,7 +515,7 @@ async function fetchMappingEntityContent(
513515
514516 const result = await response . json ( ) ;
515517 const data = result . value ?? result ;
516- if ( result [ Constants . ODATA_COUNT ] !== 0 && data . length == = 1 ) {
518+ if ( result [ Constants . ODATA_COUNT ] !== 0 && data . length > = 1 ) {
517519 return data [ 0 ] ;
518520 }
519521
0 commit comments