aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization
diff options
context:
space:
mode:
authorDiva Canto2015-08-01 18:58:05 -0700
committerDiva Canto2015-08-01 18:58:05 -0700
commite5a1243abc04c3f6f62e94425fea25b2ad84b577 (patch)
tree6b408e3b9cf8bb35a7de9042be8270df3900809f /OpenSim/Framework/Serialization
parentMantis #7664: Added IHypergridLinker interface to establish a contract about ... (diff)
downloadopensim-SC_OLD-e5a1243abc04c3f6f62e94425fea25b2ad84b577.zip
opensim-SC_OLD-e5a1243abc04c3f6f62e94425fea25b2ad84b577.tar.gz
opensim-SC_OLD-e5a1243abc04c3f6f62e94425fea25b2ad84b577.tar.bz2
opensim-SC_OLD-e5a1243abc04c3f6f62e94425fea25b2ad84b577.tar.xz
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!
Diffstat (limited to 'OpenSim/Framework/Serialization')
-rw-r--r--OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs19
1 files changed, 19 insertions, 0 deletions
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
190 if (xmlData == string.Empty || homeURL == string.Empty || userService == null) 190 if (xmlData == string.Empty || homeURL == string.Empty || userService == null)
191 return xmlData; 191 return xmlData;
192 192
193 // Deal with bug
194 xmlData = ExternalRepresentationUtils.SanitizeXml(xmlData);
195
193 using (StringWriter sw = new StringWriter()) 196 using (StringWriter sw = new StringWriter())
194 using (XmlTextWriter writer = new XmlTextWriter(sw)) 197 using (XmlTextWriter writer = new XmlTextWriter(sw))
195 using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) 198 using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
@@ -364,5 +367,21 @@ namespace OpenSim.Framework.Serialization.External
364 { 367 {
365 return homeURL + "/" + uuid + ";" + name; 368 return homeURL + "/" + uuid + ";" + name;
366 } 369 }
370
371 /// <summary>
372 /// Sanitation for bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
373 /// </summary>
374 /// <param name="xmlData"></param>
375 /// <returns></returns>
376 public static string SanitizeXml(string xmlData)
377 {
378 string fixedData = xmlData;
379 if (fixedData != null)
380 // Loop, because it may contain multiple
381 while (fixedData.Contains("xmlns:xmlns:"))
382 fixedData = fixedData.Replace("xmlns:xmlns:", "xmlns:");
383 return fixedData;
384 }
385
367 } 386 }
368} 387}