mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
104107: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud) 104059: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2) 104006: Merged DEV to V4.2-BUG-FIX (4.2.5) 83993 : MNT-12265 : Uploading a new version of a .rtf file in Mac OS breaks the preview - Using mimetype map from Alfresco at upload git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@104200 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -48,6 +48,7 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.query.PagingRequest;
|
import org.alfresco.query.PagingRequest;
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.repo.action.executer.TransformActionExecuter;
|
import org.alfresco.repo.action.executer.TransformActionExecuter;
|
||||||
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.content.transform.UnimportantTransformException;
|
import org.alfresco.repo.content.transform.UnimportantTransformException;
|
||||||
import org.alfresco.repo.content.transform.UnsupportedTransformationException;
|
import org.alfresco.repo.content.transform.UnsupportedTransformationException;
|
||||||
import org.alfresco.repo.content.transform.magick.ImageTransformationOptions;
|
import org.alfresco.repo.content.transform.magick.ImageTransformationOptions;
|
||||||
@@ -3908,8 +3909,19 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
|||||||
{
|
{
|
||||||
ContentService contentService = services.getContentService();
|
ContentService contentService = services.getContentService();
|
||||||
ContentReader reader = contentService.getReader(nodeRef, property);
|
ContentReader reader = contentService.getReader(nodeRef, property);
|
||||||
|
// MNT-12265 Browser sets a mimetype based on extension of file. But mimeType from browser can be
|
||||||
|
// different as mapped in Alfresco for current extension. Therefore we need to guess a mimetype based on
|
||||||
|
// map in Alfresco
|
||||||
|
String typeByExt = services.getMimetypeService().guessMimetype(filename);
|
||||||
|
if (reader != null && reader.getMimetype() != null && !typeByExt.equals(MimetypeMap.MIMETYPE_BINARY))
|
||||||
|
{
|
||||||
|
setMimetype(typeByExt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
setMimetype(services.getMimetypeService().guessMimetype(filename, reader));
|
setMimetype(services.getMimetypeService().guessMimetype(filename, reader));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guess the character encoding of a file. For non-text files UTF-8 default is applied, otherwise
|
* Guess the character encoding of a file. For non-text files UTF-8 default is applied, otherwise
|
||||||
|
Reference in New Issue
Block a user