mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
89398: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 89315: MNT-12642: Upload via Share Causes File Corruption Reverse Merge V4.2-BUG-FIX (4.2.4) 85882: Merged DEV to V4.2-BUG-FIX (4.2.4) 74616 : MNT-11704 : Updating Adobe Illustrator and Photoshop Documents results in loss of mimetype and preview capability - Guess mimetype using content of uploaded new file git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94623 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -3767,11 +3767,6 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
|||||||
* the Content object as supplied.
|
* the Content object as supplied.
|
||||||
*/
|
*/
|
||||||
public void write(Content content, boolean applyMimetype, boolean guessEncoding)
|
public void write(Content content, boolean applyMimetype, boolean guessEncoding)
|
||||||
{
|
|
||||||
write(content, applyMimetype, guessEncoding, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void write(Content content, boolean applyMimetype, boolean guessEncoding, boolean guessMimetype)
|
|
||||||
{
|
{
|
||||||
ContentService contentService = services.getContentService();
|
ContentService contentService = services.getContentService();
|
||||||
ContentWriter writer = contentService.getWriter(nodeRef, this.property, true);
|
ContentWriter writer = contentService.getWriter(nodeRef, this.property, true);
|
||||||
@@ -3780,19 +3775,6 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
|||||||
{
|
{
|
||||||
writer.setMimetype(content.getMimetype());
|
writer.setMimetype(content.getMimetype());
|
||||||
}
|
}
|
||||||
if (guessMimetype)
|
|
||||||
{
|
|
||||||
InputStream reuseableIS = new ReuseableInputStream(content.getInputStream());
|
|
||||||
writer.setMimetype(services.getMimetypeService().guessMimetype(getName(), reuseableIS));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
reuseableIS.reset();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guessEncoding)
|
if (guessEncoding)
|
||||||
{
|
{
|
||||||
is = new BufferedInputStream(content.getInputStream());
|
is = new BufferedInputStream(content.getInputStream());
|
||||||
@@ -3967,31 +3949,6 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
|||||||
|
|
||||||
private ContentData contentData;
|
private ContentData contentData;
|
||||||
private QName property;
|
private QName property;
|
||||||
|
|
||||||
public class ReuseableInputStream extends BufferedInputStream
|
|
||||||
{
|
|
||||||
InputStream decorated;
|
|
||||||
|
|
||||||
ReuseableInputStream(InputStream decorated)
|
|
||||||
{
|
|
||||||
super(decorated);
|
|
||||||
|
|
||||||
decorated.mark(1024);
|
|
||||||
|
|
||||||
this.decorated = decorated;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() throws IOException
|
|
||||||
{
|
|
||||||
decorated.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close(boolean force) throws IOException
|
|
||||||
{
|
|
||||||
decorated.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user