diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index be275c0f4a..f418443cac 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -270,13 +270,28 @@ namespace OpenSim.Services.InventoryService public bool AddFolder(InventoryFolderBase folder) { + InventoryFolderBase check = GetFolder(folder); + if (check != null) + return false; + XInventoryFolder xFolder = ConvertFromOpenSim(folder); return m_Database.StoreFolder(xFolder); } public bool UpdateFolder(InventoryFolderBase folder) { - return AddFolder(folder); + XInventoryFolder xFolder = ConvertFromOpenSim(folder); + InventoryFolderBase check = GetFolder(folder); + if (check == null) + return AddFolder(folder); + + if (check.Type != -1 || xFolder.type != -1) + return false; + + xFolder.version = check.Version; + xFolder.folderID = check.ID; + + return m_Database.StoreFolder(xFolder); } public bool MoveFolder(InventoryFolderBase folder)