Merged V3.4 to HEAD

24791: Fixed ALF-6560: MIME type not detected (set to application/octet-stream) when content written via FileFolderService


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@24886 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-01-17 17:02:10 +00:00
parent 803321fd1c
commit 265d282b76
2 changed files with 24 additions and 1 deletions

View File

@@ -1133,7 +1133,17 @@ public class FileFolderServiceImpl implements FileFolderService
{
throw new InvalidTypeException("Unable to get a content writer for a folder: " + fileInfo);
}
return contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
final ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
// Ensure that a mimetype is set based on the filename (ALF-6560)
// This has been removed from the create code in 3.4 to prevent insert-update behaviour
// of the ContentData.
if (writer.getMimetype() == null)
{
final String name = fileInfo.getName();
writer.setMimetype(mimetypeService.guessMimetype(name));
}
// Done
return writer;
}
private String getExtension(String name)