aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java b/src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java
index 9f2b6fb..0745bcc 100644
--- a/src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java
+++ b/src/main/java/at/gv/egiz/pdfas/web/helper/TempDirHelper.java
@@ -149,6 +149,8 @@ public class TempDirHelper
protected static String formatFileName(String fileNameSuffix)
{
+ // double check so that file name is always correct.
+ fileNameSuffix = extractFileNameSuffix(fileNameSuffix);
String fileName = "tmp" + formatIndex(runningIndex) + "_" + fileNameSuffix;
runningIndex++;
@@ -239,4 +241,14 @@ public class TempDirHelper
}
}
+ /**
+ * Given a file (maybe with path), extracts the file name suffix.
+ * @param file The file and maybe path.
+ * @return Returns the file name.
+ */
+ public static String extractFileNameSuffix (String file)
+ {
+ File f = new File(file);
+ return f.getName();
+ }
}