From cf2a88ade8765f04174952c26f192f156b2df102 Mon Sep 17 00:00:00 2001 From: leebj Date: Mon, 24 Jun 2024 13:10:06 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=ED=8C=8C=EC=9D=BC=20=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=EB=A1=9C=EB=93=9C=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsp/adds/nims/dsuseMgtRslt-info.jsp | 17 +++++++++-------- .../resources/js/adds/cmmn/adds-cmmnUtil.js | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 9 deletions(-) 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