diff options
author | netconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-08-27 07:02:57 +0000 |
---|---|---|
committer | netconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-08-27 07:02:57 +0000 |
commit | 20e23aa9edcae9b5d087f369c76831ec1b60dc13 (patch) | |
tree | c7eb97d7afafef70eb1f028b643c1570a71dbd98 /src/main/java | |
parent | 60432098ad277b27d6ca842d4594a3fe2d4f5024 (diff) | |
download | pdf-as-3-20e23aa9edcae9b5d087f369c76831ec1b60dc13.tar.gz pdf-as-3-20e23aa9edcae9b5d087f369c76831ec1b60dc13.tar.bz2 pdf-as-3-20e23aa9edcae9b5d087f369c76831ec1b60dc13.zip |
bugfix "IE 6/7 upload"
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@200 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java')
3 files changed, 19 insertions, 4 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();
+ }
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java index 3f1342d..0ebe3ea 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java @@ -230,6 +230,7 @@ public class SignServlet extends HttpServlet request.setAttribute("error", "Fehler beim Upload der Daten");
request.setAttribute("cause", "Beim Upload der Daten ist ein Fehler aufgetreten.");
dispatch(request, response, "/jsp/error.jsp");
+ return;
}
}
try
@@ -394,7 +395,7 @@ public class SignServlet extends HttpServlet String sig_type = sig_type_fi.getString("UTF-8"); //$NON-NLS-1$
String sig_app = sig_app_fi.getString("UTF-8"); //$NON-NLS-1$
- String doc_file_name = file_upload_fi.getName();
+ String doc_file_name = TempDirHelper.extractFileNameSuffix(file_upload_fi.getName());
log.debug("file content type =" + file_upload_fi.getContentType()); //$NON-NLS-1$
String extension = VerifyServlet.extractExtension(doc_file_name);
@@ -415,7 +416,7 @@ public class SignServlet extends HttpServlet }
catch (IOException e)
{
- throw new PDFDocumentException(201, "Couldn't store the file in the temp dir.");
+ throw new PDFDocumentException(201, "Couldn't store the file in the temp dir.", e);
}
// byte[] pdf = file_upload_fi.get();
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java index bb6a13f..38f3e64 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java @@ -273,7 +273,8 @@ public class VerifyServlet extends HttpServlet {
try
{
- PdfDataSource pdfDataSource = TempDirHelper.placePdfIntoTempDir(upload_fi.getInputStream(), upload_fi.getName());
+ String fileNameSuffix = TempDirHelper.extractFileNameSuffix(upload_fi.getName());
+ PdfDataSource pdfDataSource = TempDirHelper.placePdfIntoTempDir(upload_fi.getInputStream(), fileNameSuffix);
return pdfDataSource;
}
catch (IOException e)
@@ -285,8 +286,9 @@ public class VerifyServlet extends HttpServlet try
{
+ String fileNameSuffix = TempDirHelper.extractFileNameSuffix(upload_fi.getName());
String text = new String(upload_fi.get(), "UTF-8"); //$NON-NLS-1$
- TextDataSource textDataSource = TempDirHelper.placeTextIntoTempDir(text, upload_fi.getName());
+ TextDataSource textDataSource = TempDirHelper.placeTextIntoTempDir(text, fileNameSuffix);
return textDataSource;
}
catch (IOException e)
|