From 671143b62e870f763aac4f4f7213ee0e161eaac8 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Sun, 26 Nov 2023 12:47:59 +0100 Subject: [PATCH] filter special characters when exporting documents. issue #2207. --- .../jdimension/jlawyer/export/HTMLExport.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/export/HTMLExport.java b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/export/HTMLExport.java index 00bad82be..45da2d7c7 100644 --- a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/export/HTMLExport.java +++ b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/export/HTMLExport.java @@ -886,7 +886,7 @@ public String export(ArchiveFileBean dto, Date lastModified) throws Exception { } try { sContent = sContent.replaceAll("\\{\\{history\\}\\}", sb.toString()); - } catch (Throwable t) { + } catch (Exception t) { log.error("failed to add history to export, replacement string was " + sb.toString(), t); } @@ -918,24 +918,24 @@ public String export(ArchiveFileBean dto, Date lastModified) throws Exception { String dbNewName = removeSonderzeichen(db.getName()); - dbNewName = dbNewName.replaceAll(",", ""); - dbNewName = dbNewName.replaceAll("\"", ""); - dbNewName = dbNewName.replaceAll("§", ""); - dbNewName = dbNewName.replaceAll("%", ""); - dbNewName = dbNewName.replaceAll("&", ""); - dbNewName = dbNewName.replaceAll("/", ""); - dbNewName = dbNewName.replaceAll("=", ""); - dbNewName = dbNewName.replaceAll("\\?", ""); - dbNewName = dbNewName.replaceAll("\\{", ""); - dbNewName = dbNewName.replaceAll("\\}", ""); - dbNewName = dbNewName.replaceAll("\\[", ""); - dbNewName = dbNewName.replaceAll("\\]", ""); - dbNewName = dbNewName.replaceAll("\\\\", ""); - dbNewName = dbNewName.replaceAll("\\*", ""); - dbNewName = dbNewName.replaceAll("#", ""); - dbNewName = dbNewName.replaceAll("'", ""); - dbNewName = dbNewName.replaceAll(":", ""); - dbNewName = dbNewName.replaceAll(";", ""); + dbNewName = dbNewName.replace(",", ""); + dbNewName = dbNewName.replace("\"", ""); + dbNewName = dbNewName.replace("§", ""); + dbNewName = dbNewName.replace("%", ""); + dbNewName = dbNewName.replace("&", ""); + dbNewName = dbNewName.replace("/", ""); + dbNewName = dbNewName.replace("=", ""); + dbNewName = dbNewName.replace("\\?", ""); + dbNewName = dbNewName.replace("\\{", ""); + dbNewName = dbNewName.replace("\\}", ""); + dbNewName = dbNewName.replace("\\[", ""); + dbNewName = dbNewName.replace("\\]", ""); + dbNewName = dbNewName.replace("\\\\", ""); + dbNewName = dbNewName.replace("\\*", ""); + dbNewName = dbNewName.replace("#", ""); + dbNewName = dbNewName.replace("'", ""); + dbNewName = dbNewName.replace(":", ""); + dbNewName = dbNewName.replace(";", ""); if(dbNewName.length()==0) { log.warn("invalid file name: " + dbNewName);