Skip to content

Commit

Permalink
filter special characters when exporting documents. issue #2207.
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 26, 2023
1 parent 8a2255c commit 671143b
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 671143b

Please sign in to comment.