aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-11-05 18:53:25 +0000
committerJustin Clark-Casey (justincc)2009-11-05 18:53:25 +0000
commit345ddcd0d82b15afa790ede4c1e8d93361a0d405 (patch)
tree69a8280f1ab48491937a2feca44e6b40bcdd83c4 /OpenSim
parentPatch by revolution, thank you. Mantis #1789 . Implement friends permissions. (diff)
downloadopensim-SC-345ddcd0d82b15afa790ede4c1e8d93361a0d405.zip
opensim-SC-345ddcd0d82b15afa790ede4c1e8d93361a0d405.tar.gz
opensim-SC-345ddcd0d82b15afa790ede4c1e8d93361a0d405.tar.bz2
opensim-SC-345ddcd0d82b15afa790ede4c1e8d93361a0d405.tar.xz
* Escape / character when saving items and folders in an iar so that the loader doesn't barf
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs13
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs7
2 files changed, 18 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index f761bf0..7abaac0 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
161 failedAssetRestores++; 161 failedAssetRestores++;
162 } 162 }
163 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) 163 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
164 { 164 {
165 InventoryFolderBase foundFolder 165 InventoryFolderBase foundFolder
166 = ReplicateArchivePathToUserInventory( 166 = ReplicateArchivePathToUserInventory(
167 filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType, 167 filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType,
168 rootDestinationFolder, foldersCreated, nodesLoaded); 168 rootDestinationFolder, foldersCreated, nodesLoaded);
169 169
170 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) 170 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
171 { 171 {
172 // Escape back characters
173 filePath = filePath.Replace("/", "/");
174 filePath = filePath.Replace("&", "&");
175
172 InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data); 176 InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data);
173 177
174 // Don't use the item ID that's in the file 178 // Don't use the item ID that's in the file
@@ -289,6 +293,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
289 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); 293 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
290 294
291 string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex); 295 string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
296
297 // Escape back characters
298 newFolderName = newFolderName.Replace("/", "/");
299 newFolderName = newFolderName.Replace("&", "&");
300
292 UUID newFolderId = UUID.Random(); 301 UUID newFolderId = UUID.Random();
293 302
294 // Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be 303 // 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 499c552..af0b72f 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
394 /// <returns></returns> 394 /// <returns></returns>
395 public static string CreateArchiveFolderName(string name, UUID id) 395 public static string CreateArchiveFolderName(string name, UUID id)
396 { 396 {
397 // Only encode ampersands (for escaping anything) and / (since this is used as general dir separator).
398 name = name.Replace("&", "&amp;");
399 name = name.Replace("/", "&#47;");
400
397 return string.Format( 401 return string.Format(
398 "{0}{1}{2}/", 402 "{0}{1}{2}/",
399 name, 403 name,
@@ -409,6 +413,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
409 /// <returns></returns> 413 /// <returns></returns>
410 public static string CreateArchiveItemName(string name, UUID id) 414 public static string CreateArchiveItemName(string name, UUID id)
411 { 415 {
416 name = name.Replace("&", "&amp;");
417 name = name.Replace("/", "&#47;");
418
412 return string.Format( 419 return string.Format(
413 "{0}{1}{2}.xml", 420 "{0}{1}{2}.xml",
414 name, 421 name,