From e5a1243abc04c3f6f62e94425fea25b2ad84b577 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 1 Aug 2015 18:58:05 -0700 Subject: Mantis #7657 and #7514. This should alleviate the problem of bad object assets being passed around via HG and archives. No guarantees that all the leaks have been found, but at least it detects and fixes these bad assets upon: (1) storing and getting assets over HG -- assuming the core HG asset service is being used (not the case with OSGrid!) (2) importing assets via OAR and IAR Instantiation of bad assets now should also work, instead of producing an exception, but the bad assets themselves aren't being fixed in the DB. That should be done with a cleaning tool -- see Perl script in Mantis #7657. Virus! --- .../External/ExternalRepresentationUtils.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Framework/Serialization') diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index 64de18b..1254086 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -190,6 +190,9 @@ namespace OpenSim.Framework.Serialization.External if (xmlData == string.Empty || homeURL == string.Empty || userService == null) return xmlData; + // Deal with bug + xmlData = ExternalRepresentationUtils.SanitizeXml(xmlData); + using (StringWriter sw = new StringWriter()) using (XmlTextWriter writer = new XmlTextWriter(sw)) using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) @@ -364,5 +367,21 @@ namespace OpenSim.Framework.Serialization.External { return homeURL + "/" + uuid + ";" + name; } + + /// + /// Sanitation for bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8) + /// + /// + /// + public static string SanitizeXml(string xmlData) + { + string fixedData = xmlData; + if (fixedData != null) + // Loop, because it may contain multiple + while (fixedData.Contains("xmlns:xmlns:")) + fixedData = fixedData.Replace("xmlns:xmlns:", "xmlns:"); + return fixedData; + } + } } -- cgit v1.1