aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs13
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs25
2 files changed, 37 insertions, 1 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
index 1ad543b..5c7a3df 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs
@@ -587,6 +587,15 @@ namespace OpenSim.Capabilities.Handlers
587 587
588 AddLibraryFolders(fetchFolders, result); 588 AddLibraryFolders(fetchFolders, result);
589 589
590 // Filter folder Zero right here. Some viewers (Firestorm) send request for folder Zero, which doesn't make sense
591 // and can kill the sim (all root folders have parent_id Zero)
592 LLSDFetchInventoryDescendents zero = fetchFolders.Find(f => f.folder_id == UUID.Zero);
593 if (zero != null)
594 {
595 fetchFolders.Remove(zero);
596 BadFolder(zero, null, bad_folders);
597 }
598
590 if (fetchFolders.Count > 0) 599 if (fetchFolders.Count > 0)
591 { 600 {
592 UUID[] fids = new UUID[fetchFolders.Count]; 601 UUID[] fids = new UUID[fetchFolders.Count];
@@ -600,7 +609,9 @@ namespace OpenSim.Capabilities.Handlers
600 609
601 if (fetchedContents == null || (fetchedContents != null && fetchedContents.Length == 0)) 610 if (fetchedContents == null || (fetchedContents != null && fetchedContents.Length == 0))
602 { 611 {
603 //m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Could not get contents of multiple folders for user {0}", fetchFolders[0].owner_id); 612 m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Could not get contents of multiple folders for user {0}", fetchFolders[0].owner_id);
613 foreach (LLSDFetchInventoryDescendents freq in fetchFolders)
614 BadFolder(freq, null, bad_folders);
604 return null; 615 return null;
605 } 616 }
606 617
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
index 380c54a..0b66835 100644
--- a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
+++ b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs
@@ -262,6 +262,31 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
262 count = Regex.Matches(llsdresponse, notecards_folder).Count; 262 count = Regex.Matches(llsdresponse, notecards_folder).Count;
263 Assert.AreEqual(2, count, "More than 1 notecards folder in response"); // Notecards will also be under root, so 2 263 Assert.AreEqual(2, count, "More than 1 notecards folder in response"); // Notecards will also be under root, so 2
264 } 264 }
265
266 [Test]
267 public void Test_005_FolderZero()
268 {
269 TestHelpers.InMethod();
270
271 Init();
272
273 FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
274 TestOSHttpRequest req = new TestOSHttpRequest();
275 TestOSHttpResponse resp = new TestOSHttpResponse();
276
277 string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
278 request += UUID.Zero;
279 request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
280
281 string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
282
283 Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
284 Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
285 Assert.That(llsdresponse.Contains("bad_folders</key><array><uuid>00000000-0000-0000-0000-000000000000"), Is.True, "Folder Zero should be a bad folder");
286
287 Console.WriteLine(llsdresponse);
288 }
289
265 } 290 }
266 291
267} \ No newline at end of file 292} \ No newline at end of file