diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp index e9f27ec..de1da81 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp @@ -477,13 +477,13 @@ if($P.fileInfos.length > 0){ let promiseArr = []; - // URL에 c: d: 제거 + $P.fileInfos.forEach(f => { - // FIXME: URL에 c: d: 제거 ??? - // if(f.URL){ - // f.URL = f.URL.toLowerCase().replace(/c:/g, ""); - // f.URL = f.URL.toLowerCase().replace(/d:/g, ""); - // } + // URL에 c: d: 제거 + if(/^[a-zA-Z][\:]/.test(f.URL)){ + f.URL = f.URL.substring(2); + } + try{ fnCreateFileFromFileInfo(f) promiseArr.push(fnCreateFileFromFileInfo(f)); @@ -497,8 +497,9 @@ $P.fileArr = $P.fileArr.concat(values); $P.fnDisplay(); }).catch((error) => { - alert(error); - dialog.close($P.control.prefix + "Dialog--${openerPageName}"); + + //alert(error); + //dialog.close($P.control.prefix + "Dialog--${openerPageName}"); }); } }); diff --git a/src/main/webapp/resources/js/adds/cmmn/adds-cmmnUtil.js b/src/main/webapp/resources/js/adds/cmmn/adds-cmmnUtil.js index 321d543..6784418 100644 --- a/src/main/webapp/resources/js/adds/cmmn/adds-cmmnUtil.js +++ b/src/main/webapp/resources/js/adds/cmmn/adds-cmmnUtil.js @@ -2,8 +2,25 @@ * 서버의 파일 정보로 javascript File 객체 생성 **************************************************************************/ async function fnCreateFileFromFileInfo(fileInfo){ + if(/^[a-zA-Z][\:]/.test(fileInfo.URL)){ + fileInfo.URL = fileInfo.URL.substring(2); + } + + let response = null; + try { + response = await fetch(fileInfo.URL); + } catch(error){ + let data = new Blob(); + let metadata = { + type: fileInfo.MIME_TYPE + }; + let file = new File([data], fileInfo.FILE_NM, metadata); + file.id = fileInfo.FILE_ID; + file.url = fileInfo.URL; - let response = await fetch(fileInfo.URL); + return new Promise(resolve => { resolve(file); }); + } + let data = await response.blob(); let metadata = { type: fileInfo.MIME_TYPE