diff --git a/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java b/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java index 4e8679ed3..13e9d5bab 100644 --- a/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java +++ b/source/java/org/alfresco/web/bean/CheckinCheckoutBean.java @@ -831,7 +831,8 @@ public class CheckinCheckoutBean { try { - tx = Repository.getUserTransaction(FacesContext.getCurrentInstance()); + FacesContext context = FacesContext.getCurrentInstance(); + tx = Repository.getUserTransaction(context); tx.begin(); if (logger.isDebugEnabled()) @@ -839,7 +840,12 @@ public class CheckinCheckoutBean // get an updating writer that we can use to modify the content on the current node ContentWriter writer = this.contentService.getWriter(node.getNodeRef(), ContentModel.PROP_CONTENT, true); - writer.putContent(this.file); + + // also update the mime type in case a different type of file is uploaded + String mimeType = Repository.getMimeTypeForFileName(context, this.fileName); + writer.setMimetype(mimeType); + + writer.putContent(this.file); // commit the transaction tx.commit();