* Escape / character when saving items and folders in an iar so that the loader doesn't barf

0.6.8-post-fixes
Justin Clark-Casey (justincc) 2009-11-05 18:53:25 +00:00
parent 83b4b4440b
commit 345ddcd0d8
2 changed files with 18 additions and 2 deletions

View File

@ -161,14 +161,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
failedAssetRestores++;
}
else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
{
{
InventoryFolderBase foundFolder
= ReplicateArchivePathToUserInventory(
filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType,
rootDestinationFolder, foldersCreated, nodesLoaded);
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
{
{
// Escape back characters
filePath = filePath.Replace("/", "/");
filePath = filePath.Replace("&", "&");
InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data);
// Don't use the item ID that's in the file
@ -289,6 +293,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
// Escape back characters
newFolderName = newFolderName.Replace("/", "/");
newFolderName = newFolderName.Replace("&", "&");
UUID newFolderId = UUID.Random();
// Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be

View File

@ -394,6 +394,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <returns></returns>
public static string CreateArchiveFolderName(string name, UUID id)
{
// Only encode ampersands (for escaping anything) and / (since this is used as general dir separator).
name = name.Replace("&", "&amp;");
name = name.Replace("/", "&#47;");
return string.Format(
"{0}{1}{2}/",
name,
@ -409,6 +413,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <returns></returns>
public static string CreateArchiveItemName(string name, UUID id)
{
name = name.Replace("&", "&amp;");
name = name.Replace("/", "&#47;");
return string.Format(
"{0}{1}{2}.xml",
name,