mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for (unreported?) issue where uploaded large files via upload.post.js does not work after recent optimizations
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31214 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.jscript;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -3488,7 +3489,16 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
||||
}
|
||||
if (guessEncoding)
|
||||
{
|
||||
writer.setEncoding(guessEncoding(content.getInputStream()));
|
||||
InputStream is = new BufferedInputStream(content.getInputStream());
|
||||
is.mark(1024);
|
||||
writer.setEncoding(guessEncoding(is, false));
|
||||
try
|
||||
{
|
||||
is.reset();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3618,10 +3628,10 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
||||
*/
|
||||
public void guessEncoding()
|
||||
{
|
||||
setEncoding(guessEncoding(getInputStream()));
|
||||
setEncoding(guessEncoding(getInputStream(), true));
|
||||
}
|
||||
|
||||
private String guessEncoding(InputStream in)
|
||||
private String guessEncoding(InputStream in, boolean close)
|
||||
{
|
||||
String encoding = "UTF-8";
|
||||
try
|
||||
@@ -3636,7 +3646,7 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
||||
{
|
||||
try
|
||||
{
|
||||
if (in != null)
|
||||
if (close && in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user