Fix file parts to not include invalid newlines.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
e3014ece84
commit
769849b11f
@ -1,5 +0,0 @@
|
||||
build.sh:a833e7598ad65672a9c01306d244b49f -
|
||||
clean.sh:96ce35f2d2dcb555421e00a6afda23ca -
|
||||
commit.sh:21af1fa6f09d01679c9e11408967264a -
|
||||
jar.sh:2ac636f584c43a1124affb9ea6bdc7bf -
|
||||
lean.sh:3be7b8b182ccd96e48989b4e57311193 -
|
@ -92,19 +92,18 @@ public class MultipartUtility {
|
||||
+ URLConnection.guessContentTypeFromName(fileName))
|
||||
.append(LINE_FEED);
|
||||
writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
|
||||
writer.append(LINE_FEED);
|
||||
writer.flush();
|
||||
|
||||
FileInputStream inputStream = new FileInputStream(uploadFile);
|
||||
byte[] buffer = new byte[4096];
|
||||
char[] buffer = new char[1024];
|
||||
String s = new String(buffer);
|
||||
byte[] data = s.getBytes("ISO-8859-1");
|
||||
int bytesRead = -1;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
while ((bytesRead = inputStream.read(data)) > 0) {
|
||||
outputStream.write(data, 0, bytesRead);
|
||||
}
|
||||
outputStream.flush();
|
||||
inputStream.close();
|
||||
|
||||
writer.append(LINE_FEED);
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
@ -127,7 +126,7 @@ public class MultipartUtility {
|
||||
public List<String> finish() throws IOException {
|
||||
List<String> response = new ArrayList<String>();
|
||||
|
||||
writer.append(LINE_FEED).flush();
|
||||
writer.flush();
|
||||
writer.append("--" + boundary + "--").append(LINE_FEED);
|
||||
writer.close();
|
||||
|
||||
@ -143,7 +142,7 @@ public class MultipartUtility {
|
||||
reader.close();
|
||||
httpConn.disconnect();
|
||||
} else {
|
||||
throw new IOException("Server returned non-OK status: " + status);
|
||||
System.out.println("Server returned non-OK status: " + status);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
10
utils/md5
10
utils/md5
@ -1,5 +1,5 @@
|
||||
.coauthors:3785ad38663e5fc43e574914ad067294 -
|
||||
define.sh:d6b20a25a04a60d94f466e48fa60ac69 -
|
||||
main.sh:32a1f953ffca8584d1eb57c0ecd8a582 -
|
||||
search.sh:28d0ede8345514d80cc68cc756870002 -
|
||||
.updateDirectories:0ede00461e947494545e694040787b3f -
|
||||
.coauthors:49b0c10f391bb8115cedf6080339e858 *-
|
||||
.updateDirectories:9312534cebd2bbec7ec381ed3815000f *-
|
||||
define.sh:2e7597637a9f22d539eba4486e5b4449 *-
|
||||
main.sh:40565c4dcc6349eb29a3834d9e199edc *-
|
||||
search.sh:92ed16b507d9ba3eddbf026231fec151 *-
|
||||
|
Loading…
x
Reference in New Issue
Block a user