Merged HEAD (5.1) to 5.1.N (5.1.1)

116418 mrogers: ACE-4523 - Binary File mimetype is set to files edited via CIFS/FTP


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@117194 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tatyana Valkevych
2015-11-11 11:50:23 +00:00
parent 900c723a70
commit d908acd417
3 changed files with 164 additions and 1 deletions

View File

@@ -3035,9 +3035,28 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
nodeService.setProperty(target, ContentModel.PROP_MODIFIED, new Date());
}
// Take an initial guess at the mimetype (if it has not been set by something already)
/**
* Take a guess at the mimetype
*/
String mimetype = mimetypeService.guessMimetype(tempFile.getFullName(), new FileContentReader(tempFile.getFile()));
logger.debug("guesssed mimetype:" + mimetype);
/**
* mime type guessing may have failed in which case we should assume the mimetype has not changed.
*/
if(mimetype.equalsIgnoreCase(MimetypeMap.MIMETYPE_BINARY))
{
// mimetype guessing may have failed
if(existingContent != null)
{
// copy the mimetype from the existing content.
mimetype = existingContent.getMimetype();
if(logger.isDebugEnabled())
{
logger.debug("using mimetype of existing content :" + mimetype);
}
}
}
String encoding;
// Take a guess at the locale