From 2f7aaab592e5660d4c5d00198718f01762b8819e Mon Sep 17 00:00:00 2001 From: Gary Spencer Date: Tue, 31 Jan 2006 15:47:59 +0000 Subject: [PATCH] Added check for open for overwrite in the main openFile() method so that it covers FTP as well as CIFS file opens. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2263 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../filesys/smb/server/repo/ContentDiskDriver.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/java/org/alfresco/filesys/smb/server/repo/ContentDiskDriver.java b/source/java/org/alfresco/filesys/smb/server/repo/ContentDiskDriver.java index 5568e57b24..f9d76a2a41 100644 --- a/source/java/org/alfresco/filesys/smb/server/repo/ContentDiskDriver.java +++ b/source/java/org/alfresco/filesys/smb/server/repo/ContentDiskDriver.java @@ -945,6 +945,16 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface fstate.setNodeRef(nodeRef); } + // If the file has been opened for overwrite then truncate the file to zero length, this will + // also prevent the existing content data from being copied to the new version of the file + + if ( params.isOverwrite() && netFile != null) + { + // Truncate the file to zero length + + netFile.truncateFile( 0L); + } + // Debug if (logger.isDebugEnabled())