From c8cd2f18f5af98003b342ca33112e82e294d759e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 1 Aug 2015 20:27:04 -0700 Subject: Mantis #7657: similar fixes for FSAssets. --- OpenSim/Services/FSAssetService/FSAssetService.cs | 29 ++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs index 04f6d79..c2e379b 100644 --- a/OpenSim/Services/FSAssetService/FSAssetService.cs +++ b/OpenSim/Services/FSAssetService/FSAssetService.cs @@ -35,6 +35,7 @@ using System.Threading; using System.Reflection; using OpenSim.Data; using OpenSim.Framework; +using OpenSim.Framework.Serialization.External; using OpenSim.Framework.Console; using OpenSim.Server.Base; using OpenSim.Services.Base; @@ -394,9 +395,18 @@ namespace OpenSim.Services.FSAssetService } if (asset == null) m_missingAssetsFS++; - // m_log.InfoFormat("[FSASSETS]: Asset {0}, hash {1} not found in FS", id, hash); + // m_log.InfoFormat("[FSASSETS]: Asset {0}, hash {1} not found in FS", id, hash); else + { + // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) + // Fix bad assets before sending them elsewhere + if (asset.Type == (int)AssetType.Object && asset.Data != null) + { + string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); + asset.Data = Utils.StringToBytes(xml); + } return asset; + } } lock (m_statsLock) @@ -404,6 +414,15 @@ namespace OpenSim.Services.FSAssetService m_readTicks += Environment.TickCount - startTime; m_readCount++; } + + // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) + // Fix bad assets before sending them elsewhere + if (newAsset.Type == (int)AssetType.Object && newAsset.Data != null) + { + string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(newAsset.Data)); + newAsset.Data = Utils.StringToBytes(xml); + } + return newAsset; } catch (Exception exception) @@ -519,6 +538,14 @@ namespace OpenSim.Services.FSAssetService if (!File.Exists(finalFile)) { + // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) + // Fix bad assets before storing on this server + if (asset.Type == (int)AssetType.Object && asset.Data != null) + { + string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data)); + asset.Data = Utils.StringToBytes(xml); + } + FileStream fs = File.Create(tempFile); fs.Write(asset.Data, 0, asset.Data.Length); -- cgit v1.1