refactor out iar escaping
parent
1ded7edde2
commit
716f70cd31
|
@ -254,10 +254,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
|
||||
|
||||
// Escape back characters
|
||||
newFolderName = newFolderName.Replace("/", "/");
|
||||
newFolderName = newFolderName.Replace("&", "&");
|
||||
|
||||
newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName);
|
||||
UUID newFolderId = UUID.Random();
|
||||
|
||||
// Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be
|
||||
|
@ -338,10 +335,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="nodesLoaded">All the inventory nodes (items and folders) loaded so far</param>
|
||||
protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder)
|
||||
{
|
||||
// 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
|
||||
|
|
|
@ -295,5 +295,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Escape an archive path.
|
||||
/// </summary>
|
||||
/// This has to be done differently from human paths because we can't leave in any "/" characters (due to
|
||||
/// problems if the archive is built from or extracted to a filesystem
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static string EscapeArchivePath(string path)
|
||||
{
|
||||
// Only encode ampersands (for escaping anything) and / (since this is used as general dir separator).
|
||||
return path.Replace("&", "&").Replace("/", "/");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unescape an archive path.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static string UnescapeArchivePath(string path)
|
||||
{
|
||||
return path.Replace("/", "/").Replace("&", "&");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -362,13 +362,9 @@ 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("&", "&");
|
||||
name = name.Replace("/", "/");
|
||||
|
||||
return string.Format(
|
||||
"{0}{1}{2}/",
|
||||
name,
|
||||
InventoryArchiveUtils.EscapeArchivePath(name),
|
||||
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
|
||||
id);
|
||||
}
|
||||
|
@ -381,12 +377,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <returns></returns>
|
||||
public static string CreateArchiveItemName(string name, UUID id)
|
||||
{
|
||||
name = name.Replace("&", "&");
|
||||
name = name.Replace("/", "/");
|
||||
|
||||
return string.Format(
|
||||
"{0}{1}{2}.xml",
|
||||
name,
|
||||
InventoryArchiveUtils.EscapeArchivePath(name),
|
||||
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
|
||||
id);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue