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).
0.6.4-rc1
Mike Mazur 2009-03-05 08:30:23 +00:00
parent 6994d9239d
commit 1894d69c8a
2 changed files with 9 additions and 4 deletions

View File

@ -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);

View File

@ -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
}