diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index f761bf0c53..7abaac0213 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -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
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 499c552a4a..af0b72f664 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -394,6 +394,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
///
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,
@@ -409,6 +413,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
///
public static string CreateArchiveItemName(string name, UUID id)
{
+ name = name.Replace("&", "&");
+ name = name.Replace("/", "/");
+
return string.Format(
"{0}{1}{2}.xml",
name,