Making sure file names don't have spaces at the end

This commit is contained in:
Eugene Livis 2021-09-29 09:41:35 -04:00
parent eec5c62704
commit 48f1e09a36

View File

@ -169,7 +169,8 @@ public class FileUtil {
public static String escapeFileName(String fileName) {
//for now escaping /:"*?<>| (not valid in file name, at least on Windows)
//with underscores. We are only keeping \ as it could be part of the path.
return fileName.replaceAll("[\\p{Cntrl}/:\"*?<>|]+", "_");
// Also trim empty space characters at the end of file name.
return fileName.replaceAll("[\\p{Cntrl}/:\"*?<>|]+", "_").trim();
}
/**