diff --git a/source/java/org/alfresco/repo/action/executer/TransformActionExecuter.java b/source/java/org/alfresco/repo/action/executer/TransformActionExecuter.java index 8bb9882aeb..f6baa43976 100644 --- a/source/java/org/alfresco/repo/action/executer/TransformActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/TransformActionExecuter.java @@ -204,7 +204,7 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase // Calculate the destination name String originalName = (String)nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME); - String newName = transformName(this.mimetypeService, originalName, mimeType); + String newName = transformName(this.mimetypeService, originalName, mimeType, true); // Since we are overwriting we need to figure out whether the destination node exists NodeRef copyNodeRef = null; @@ -260,7 +260,7 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase String originalTitle = (String)nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_TITLE); if (originalTitle != null && originalTitle.length() > 0) { - String newTitle = transformName(this.mimetypeService, originalTitle, mimeType); + String newTitle = transformName(this.mimetypeService, originalTitle, mimeType, false); nodeService.setProperty(copyNodeRef, ContentModel.PROP_TITLE, newTitle); } } @@ -317,7 +317,7 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase * * @return name with new extension as appropriate for the mimetype */ - public static String transformName(MimetypeService mimetypeService, String original, String newMimetype) + public static String transformName(MimetypeService mimetypeService, String original, String newMimetype, boolean alwaysAdd) { // get the current extension int dotIndex = original.lastIndexOf('.'); @@ -326,15 +326,23 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase { // we found it sb.append(original.substring(0, dotIndex)); + + // add the new extension + String newExtension = mimetypeService.getExtension(newMimetype); + sb.append('.').append(newExtension); } else { - // no extension + // no extension so dont add a new one sb.append(original); + + if (alwaysAdd == true) + { + // add the new extension + String newExtension = mimetypeService.getExtension(newMimetype); + sb.append('.').append(newExtension); + } } - // add the new extension - String newExtension = mimetypeService.getExtension(newMimetype); - sb.append('.').append(newExtension); // done return sb.toString(); } diff --git a/source/java/org/alfresco/repo/domain/hibernate/DbAccessControlListImpl.java b/source/java/org/alfresco/repo/domain/hibernate/DbAccessControlListImpl.java index 8be3d5bf7f..2fae4bc2db 100644 --- a/source/java/org/alfresco/repo/domain/hibernate/DbAccessControlListImpl.java +++ b/source/java/org/alfresco/repo/domain/hibernate/DbAccessControlListImpl.java @@ -171,6 +171,9 @@ public class DbAccessControlListImpl extends LifecycleAdapter // remove from the entry list entry.delete(); } + // Fix issues with deleting and adding permissions + // See AR-918 + this.getSession().flush(); // done if (logger.isDebugEnabled()) { diff --git a/source/java/org/alfresco/repo/jscript/Node.java b/source/java/org/alfresco/repo/jscript/Node.java index 0555d0f4d6..1d4030e8f3 100644 --- a/source/java/org/alfresco/repo/jscript/Node.java +++ b/source/java/org/alfresco/repo/jscript/Node.java @@ -1390,7 +1390,7 @@ public class Node implements Serializable, Scopeable { // Copy the content node to a new node String copyName = TransformActionExecuter.transformName(this.services.getMimetypeService(), getName(), - mimetype); + mimetype, true); NodeRef copyNodeRef = this.services.getCopyService().copy(this.nodeRef, destination, ContentModel.ASSOC_CONTAINS, QName.createQName(ContentModel.PROP_CONTENT.getNamespaceURI(), QName.createValidLocalName(copyName)),