From 01c9e0a933c88f0d4bbefbf4b614d5fd5545b2b2 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Fri, 3 Jun 2016 16:00:17 +0000 Subject: [PATCH] Merged 5.2.N (5.2.1) to HEAD (5.2) 124228 amorarasu: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 124145 amorarasu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2) 124106 rmunteanu: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4) 124105 amorarasu: Merged V4.1-BUG-FIX (4.1.11) to V4.2-BUG-FIX (4.2.7) 123915 rmunteanu: Merged V4.1.7 (4.1.7.18) to V4.1-BUG-FIX (4.1.11) MNT-15801 : onContentUpdate policies not working for updates via webdav - Reverted changes made for MNT-11185 and MNT-10966 , reverts that will fix MNT-15746 - Changed fix for MNT-5882 by adding the ASPECT_NO_CONTENT after the content is updated, this way preventing MNT-10966 from reproducing git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127744 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/webdav/PutMethod.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/java/org/alfresco/repo/webdav/PutMethod.java b/source/java/org/alfresco/repo/webdav/PutMethod.java index 2a36c0c152..a0eb1fe221 100644 --- a/source/java/org/alfresco/repo/webdav/PutMethod.java +++ b/source/java/org/alfresco/repo/webdav/PutMethod.java @@ -231,11 +231,6 @@ public class PutMethod extends WebDAVMethod implements ActivityPostProducer getDAVHelper().getPolicyBehaviourFilter().disableBehaviour(nodeRef, ContentModel.ASPECT_VERSIONABLE); disabledVersioning = true; } - // ALF-16756: To avoid firing inbound rules too early (while a node is still locked) apply the no content aspect - if (nodeLockInfo != null && nodeLockInfo.isExclusive() && !(ContentData.hasContent(contentData) && contentData.getSize() > 0)) - { - getNodeService().addAspect(contentNodeInfo.getNodeRef(), ContentModel.ASPECT_NO_CONTENT, null); - } // Access the content ContentWriter writer = fileFolderService.getWriter(contentNodeInfo.getNodeRef()); @@ -245,10 +240,20 @@ public class PutMethod extends WebDAVMethod implements ActivityPostProducer // Get the input stream from the request data InputStream is = m_request.getInputStream(); - + // Write the new data to the content node writer.putContent(is); + + // ALF-16756: To avoid firing inbound rules too early (while a node is still locked) apply the no content aspect + // Note, for MNT-15801, that the aspect is only applied if: + // - the node is locked AND + // - the node does not have any content (zero length binaries included) + if (nodeLockInfo != null && nodeLockInfo.getToken() != null && !(ContentData.hasContent(contentData) && contentData.getSize() > 0)) + { + getNodeService().addAspect(contentNodeInfo.getNodeRef(), ContentModel.ASPECT_NO_CONTENT, null); + } + // Ask for the document metadata to be extracted Action extract = getActionService().createAction(ContentMetadataExtracter.EXECUTOR_NAME); if(extract != null)