mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
Fixed a problem where file states were updated before the file rename call, if the rename/move call failed the file states were in an inconsistent state.
Fix for AR-1115. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5068 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1892,7 +1892,35 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
fstate.setNodeRef(renState.getNodeRef());
|
||||
fstate.setFileStatus(FileStateStatus.FileExists);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the file state for the folder, if available
|
||||
|
||||
FileState fstate = ctx.getStateTable().findFileState(oldName);
|
||||
|
||||
if ( fstate != null)
|
||||
{
|
||||
// Update the file state index to use the new name
|
||||
|
||||
ctx.getStateTable().renameFileState(newName, fstate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Move the file/folder, if not relinked to previous version history
|
||||
|
||||
if (!relinked)
|
||||
{
|
||||
// Move the file/folder
|
||||
|
||||
cifsHelper.move(nodeToMoveRef, targetFolderRef, name);
|
||||
|
||||
// Check if we renamed a file, if so then cache the rename details for a short period
|
||||
// in case another file renamed to the old name. MS Word uses renames to move a new
|
||||
// version of a document into place so we need to reconnect the version history.
|
||||
|
||||
if ( !cifsHelper.isDirectory(nodeToMoveRef))
|
||||
{
|
||||
// Get or create a new file state for the old file path
|
||||
|
||||
@@ -1928,25 +1956,6 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the file state for the folder, if available
|
||||
|
||||
FileState fstate = ctx.getStateTable().findFileState(oldName);
|
||||
|
||||
if ( fstate != null)
|
||||
{
|
||||
// Update the file state index to use the new name
|
||||
|
||||
ctx.getStateTable().renameFileState(newName, fstate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!relinked)
|
||||
{
|
||||
cifsHelper.move(nodeToMoveRef, targetFolderRef, name);
|
||||
}
|
||||
|
||||
// DEBUG
|
||||
|
||||
|
Reference in New Issue
Block a user