From 741fb208f77253b0fa80c07b32635c9e16da15bf Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 14 Jul 2021 19:59:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-52641=20=E6=96=87=E4=BB=B6=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E9=9C=80=E8=A6=81=E9=99=90=E5=88=B6=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/FileTableDataPane.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index 6eb802619f..4c9ad3cb58 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -26,6 +26,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -612,7 +613,7 @@ public class FileTableDataPane extends AbstractTableDataPane { private void setTextField(FileTableData ob) { if (ob.getFilePath() != null) { - if (ob.getFilePath().indexOf("http") != -1) { + if (ob.getFilePath().contains("http")) { urlRadioSelectAction(); urlText.setText(ob.getFilePath()); } else { @@ -625,6 +626,15 @@ public class FileTableDataPane extends AbstractTableDataPane { @Override public FileTableData updateBean() { String filePath = getFilePathFromUrlOrLocal(); + // 安全要求禁止 file 协议访问本地磁盘 + if (FileTableData.isInvalidFilePath(filePath)) { + JOptionPane.showMessageDialog(this, + Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"), + Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"), + JOptionPane.ERROR_MESSAGE); + // 阻止对话框关闭 + throw new RuntimeException(Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid")); + } if (StringUtils.isNotBlank(filePath)) { this.params = getEditorPaneParameter().length == 0 ? null : getEditorPaneParameter(); if (fileTypeComboBox.getSelectedIndex() == EXCEL) { @@ -786,6 +796,14 @@ public class FileTableDataPane extends AbstractTableDataPane { if (this.fileTableData == null) { return; } + String filePath = getFilePathFromUrlOrLocal(); + if (FileTableData.isInvalidFilePath(filePath)) { + JOptionPane.showMessageDialog(this, + Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"), + Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"), + JOptionPane.ERROR_MESSAGE); + return; + } PreviewTablePane.previewTableData(this.updateBean()); } @@ -802,7 +820,7 @@ public class FileTableDataPane extends AbstractTableDataPane { xmlNodeTree = new XMLNodeTree(); this.add(new JScrollPane(xmlNodeTree)); - keyPointLaber = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Key_Point") + ":"); + keyPointLaber = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Key_Point") + ":"); refreshAction = new RefreshParameterAction(); ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(refreshAction); @@ -820,7 +838,7 @@ public class FileTableDataPane extends AbstractTableDataPane { private class RefreshParameterAction extends UpdateAction { public RefreshParameterAction() { - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh")); + this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh")); this.setMnemonic('r'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); } From e25091c0ccc7ecca11639784d1b40ad3e7ff170f Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 15 Jul 2021 09:29:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/tabledata/tabledatapane/FileTableDataPane.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index 4c9ad3cb58..5d9d4146d6 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -628,7 +628,7 @@ public class FileTableDataPane extends AbstractTableDataPane { String filePath = getFilePathFromUrlOrLocal(); // 安全要求禁止 file 协议访问本地磁盘 if (FileTableData.isInvalidFilePath(filePath)) { - JOptionPane.showMessageDialog(this, + FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"), Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"), JOptionPane.ERROR_MESSAGE); @@ -798,7 +798,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } String filePath = getFilePathFromUrlOrLocal(); if (FileTableData.isInvalidFilePath(filePath)) { - JOptionPane.showMessageDialog(this, + FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"), Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"), JOptionPane.ERROR_MESSAGE);