fix file names

This commit is contained in:
Fabio Sinibaldi 2020-12-22 11:40:48 +01:00
parent 8bf718d3a9
commit 0630ca9a48
2 changed files with 10 additions and 1 deletions

View File

@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# [v1.0.5-SNAPSHOT] - 2020-12-9
Mongo Id in record
Mongo Concessioni interface
Added Files.fixFileNAme
# [v1.0.4-SNAPSHOT] - 2020-12-9
Projects Rest Interface

View File

@ -37,5 +37,12 @@ public class Files {
}
public static String fixFilename(String toFix) {
if(toFix.contains(".")) {
String prefix=toFix.substring(toFix.lastIndexOf("."));
toFix=toFix.substring(0,toFix.lastIndexOf("."));
return toFix.toLowerCase().replaceAll("[\\*\\+\\/\\\\ \\[\\]\\(\\)\\.\\\"\\:\\;\\|]","_")+prefix;
}
return toFix.toLowerCase().replaceAll("[\\*\\+\\/\\\\ \\[\\]\\(\\)\\.\\\"\\:\\;\\|]","_");
}
}