From 139f51e01b953c5188779c73a8cb0a82812fda4d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 29 Nov 2025 22:49:07 +0000 Subject: [PATCH] a few changes on ServiceURLs. Add some extra checks on AssetServiceURI --- OpenSim/Framework/AgentCircuitData.cs | 2 +- .../Framework/InventoryAccess/HGAssetMapper.cs | 16 +++++++++++----- .../InventoryAccess/HGInventoryAccessModule.cs | 12 +++++++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index d011a8b407..482e1ec79c 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -372,7 +372,7 @@ namespace OpenSim.Framework OSDMap urls = (OSDMap)tmpOSD; foreach (KeyValuePair kvp in urls) { - ServiceURLs[kvp.Key] = kvp.Value; + ServiceURLs[kvp.Key] = kvp.Value.AsString(); //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index 54918be9f2..5d365b67e8 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -195,11 +195,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { // The act of gathering UUIDs downloads some assets from the remote server // but not all... - HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, userAssetURL); + if(string.IsNullOrEmpty(userAssetURL)) + { + m_log.Debug($"[HG ASSET MAPPER]: Problems getting item asset {assetID}. Asset server unknown"); + return; + } + + HGUuidGatherer uuidGatherer = new(m_scene.AssetService, userAssetURL); uuidGatherer.AddForInspection(assetID); uuidGatherer.GatherAll(); - m_log.DebugFormat("[HG ASSET MAPPER]: Preparing to get {0} assets", uuidGatherer.GatheredUuids.Count); + m_log.Debug($"[HG ASSET MAPPER]: Preparing to get {uuidGatherer.GatheredUuids.Count} assets"); bool success = true; foreach (UUID uuid in uuidGatherer.GatheredUuids.Keys) { @@ -211,9 +217,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // maybe all pieces got here... if (!success) - m_log.DebugFormat("[HG ASSET MAPPER]: Problems getting item {0} from asset server {1}", assetID, userAssetURL); + m_log.Debug($"[HG ASSET MAPPER]: Problems getting item asset {assetID} from asset server {userAssetURL}"); else - m_log.DebugFormat("[HG ASSET MAPPER]: Successfully got item {0} from asset server {1}", assetID, userAssetURL); + m_log.Debug($"[HG ASSET MAPPER]: Successfully got item asset {assetID} from asset server {userAssetURL}"); } public void Post(UUID assetID, UUID ownerID, string userAssetURL) @@ -234,7 +240,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // Check which assets already exist in the destination server string url = userAssetURL; - if (!url.EndsWith("/") && !url.EndsWith("=")) + if (!url.EndsWith('/') && !url.EndsWith('=')) url = url + "/"; string[] remoteAssetIDs = new string[uuidGatherer.GatheredUuids.Count]; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index ca03e4f25f..a260399dea 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -405,6 +405,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI"); assetServerURL = assetServerURL.Trim('/'); } + if(assetServerURL.Length == 0) + { + m_log.Debug($"[HGScene]: user {userID} asset server returned empty url"); + return false; + } return true; } } @@ -417,7 +422,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } else { - m_log.DebugFormat("[HGScene]: user {0} has foreign assets {1}", userID, assetServerURL); + if(assetServerURL.Length == 0) + { + m_log.Debug($"[HGScene]: user {userID} asset server returned empty url"); + return false; + } + m_log.Debug($"[HGScene]: user {userID} has foreign assets {assetServerURL}"); return true; } }