aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorAnna Koskinen <anna@vaadin.com>2013-02-01 10:57:41 +0200
committerVaadin Code Review <review@vaadin.com>2013-02-05 14:26:33 +0000
commit799a969b087771d102d9a3f835ba4d73bc0445ad (patch)
treea814a5c54e867df7042e8213382362b94b150bff /server/src
parent515d3c39e3a02e4dc266cac7fd6919748a10e243 (diff)
downloadvaadin-framework-799a969b087771d102d9a3f835ba4d73bc0445ad.tar.gz
vaadin-framework-799a969b087771d102d9a3f835ba4d73bc0445ad.zip
Merge of (#9548) to Vaadin 7.
Calculate upload file size correctly when there are multibyte characters in the file name. Change-Id: I85f1053ce6ad29140d0a37fe8ab4861b0f717fc9
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/server/AbstractCommunicationManager.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java
index c676cb2ce3..c1c18901b4 100644
--- a/server/src/com/vaadin/server/AbstractCommunicationManager.java
+++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java
@@ -186,7 +186,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
private static final String CRLF = "\r\n";
- private static final String UTF8 = "UTF8";
+ private static final String UTF8 = "UTF-8";
private static String readLine(InputStream stream) throws IOException {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
@@ -234,14 +234,14 @@ public abstract class AbstractCommunicationManager implements Serializable {
*/
while (!atStart) {
String readLine = readLine(inputStream);
- contentLength -= (readLine.length() + 2);
+ contentLength -= (readLine.getBytes(UTF8).length + CRLF.length());
if (readLine.startsWith("Content-Disposition:")
&& readLine.indexOf("filename=") > 0) {
rawfilename = readLine.replaceAll(".*filename=", "");
- String parenthesis = rawfilename.substring(0, 1);
+ char quote = rawfilename.charAt(0);
rawfilename = rawfilename.substring(1);
rawfilename = rawfilename.substring(0,
- rawfilename.indexOf(parenthesis));
+ rawfilename.indexOf(quote));
firstFileFieldFound = true;
} else if (firstFileFieldFound && readLine.equals("")) {
atStart = true;
@@ -251,7 +251,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
contentLength -= (boundary.length() + CRLF.length() + 2
- * DASHDASH.length() + 2); // 2 == CRLF
+ * DASHDASH.length() + CRLF.length());
/*
* Reads bytes from the underlying stream. Compares the read bytes to