From 1894d69c8a582bec7a5bf96d025f12aa99287816 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Thu, 5 Mar 2009 08:30:23 +0000 Subject: Fix moving folders. Casting from base class to inherited class is a no-no, and we must preserve the folder type when moving folders, otherwise it gets set to a Texture folder (type 0). --- .../Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs | 11 ++++++++--- .../Plugins/OpenSim/OpenSimInventoryService.cs | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Grid/AssetInventoryServer') diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs index 838bc3a..705a3ef 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs @@ -227,14 +227,19 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim { Uri owner = Utils.GetOpenSimUri(folder.Owner); - // Some calls that are moving or updating a folder instead of creating a new one - // will pass in an InventoryFolder without the name set. If this is the case we - // need to look up the name first + // Some calls that are moving or updating a folder instead + // of creating a new one will pass in an InventoryFolder + // without the name set and type set to 0. If this is the + // case we need to look up the name first and preserver + // it's type. if (String.IsNullOrEmpty(folder.Name)) { InventoryFolderWithChildren oldFolder; if (m_server.InventoryProvider.TryFetchFolder(owner, folder.ID, out oldFolder) == BackendResponse.Success) + { folder.Name = oldFolder.Name; + folder.Type = oldFolder.Type; + } } BackendResponse storageResponse = m_server.InventoryProvider.TryCreateFolder(owner, folder); diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryService.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryService.cs index ca995b3..3ddd07d 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryService.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryService.cs @@ -48,7 +48,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim if (null != baseFolder) { - folder = (InventoryFolderWithChildren) baseFolder; + folder = new InventoryFolderWithChildren(baseFolder); folder.Children = null; // This call only returns data for the folder itself, no children data } -- cgit v1.1