aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs23
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs11
3 files changed, 26 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index a535633..0a2e2e4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -254,10 +254,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
254 254
255 string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex); 255 string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
256 256
257 // Escape back characters 257 newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName);
258 newFolderName = newFolderName.Replace("/", "/");
259 newFolderName = newFolderName.Replace("&", "&");
260
261 UUID newFolderId = UUID.Random(); 258 UUID newFolderId = UUID.Random();
262 259
263 // Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be 260 // 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
338 /// <param name="nodesLoaded">All the inventory nodes (items and folders) loaded so far</param> 335 /// <param name="nodesLoaded">All the inventory nodes (items and folders) loaded so far</param>
339 protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder) 336 protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder)
340 { 337 {
341 // Escape back characters
342// filePath = filePath.Replace("&#47;", "/");
343// filePath = filePath.Replace("&amp;", "&");
344
345 InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data); 338 InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data);
346 339
347 // Don't use the item ID that's in the file 340 // Don't use the item ID that's in the file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 78032d1..247cee4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -295,5 +295,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
295 295
296 return sb.ToString(); 296 return sb.ToString();
297 } 297 }
298
299 /// <summary>
300 /// Escape an archive path.
301 /// </summary>
302 /// This has to be done differently from human paths because we can't leave in any "/" characters (due to
303 /// problems if the archive is built from or extracted to a filesystem
304 /// <param name="path"></param>
305 /// <returns></returns>
306 public static string EscapeArchivePath(string path)
307 {
308 // Only encode ampersands (for escaping anything) and / (since this is used as general dir separator).
309 return path.Replace("&", "&amp;").Replace("/", "&#47;");
310 }
311
312 /// <summary>
313 /// Unescape an archive path.
314 /// </summary>
315 /// <param name="path"></param>
316 /// <returns></returns>
317 public static string UnescapeArchivePath(string path)
318 {
319 return path.Replace("&#47;", "/").Replace("&amp;", "&");
320 }
298 } 321 }
299} \ No newline at end of file 322} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 6c37198..bbb49f6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -362,13 +362,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
362 /// <returns></returns> 362 /// <returns></returns>
363 public static string CreateArchiveFolderName(string name, UUID id) 363 public static string CreateArchiveFolderName(string name, UUID id)
364 { 364 {
365 // Only encode ampersands (for escaping anything) and / (since this is used as general dir separator).
366 name = name.Replace("&", "&amp;");
367 name = name.Replace("/", "&#47;");
368
369 return string.Format( 365 return string.Format(
370 "{0}{1}{2}/", 366 "{0}{1}{2}/",
371 name, 367 InventoryArchiveUtils.EscapeArchivePath(name),
372 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, 368 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
373 id); 369 id);
374 } 370 }
@@ -381,12 +377,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
381 /// <returns></returns> 377 /// <returns></returns>
382 public static string CreateArchiveItemName(string name, UUID id) 378 public static string CreateArchiveItemName(string name, UUID id)
383 { 379 {
384 name = name.Replace("&", "&amp;");
385 name = name.Replace("/", "&#47;");
386
387 return string.Format( 380 return string.Format(
388 "{0}{1}{2}.xml", 381 "{0}{1}{2}.xml",
389 name, 382 InventoryArchiveUtils.EscapeArchivePath(name),
390 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, 383 ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
391 id); 384 id);
392 } 385 }