aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorDiva Canto2015-08-01 20:27:04 -0700
committerDiva Canto2015-08-01 20:27:04 -0700
commitc8cd2f18f5af98003b342ca33112e82e294d759e (patch)
treee12127bbfa337f00e1fbaf7621c8c9b60a864bb0 /OpenSim/Services
parentMantis #7657 and #7514. This should alleviate the problem of bad object asset... (diff)
downloadopensim-SC_OLD-c8cd2f18f5af98003b342ca33112e82e294d759e.zip
opensim-SC_OLD-c8cd2f18f5af98003b342ca33112e82e294d759e.tar.gz
opensim-SC_OLD-c8cd2f18f5af98003b342ca33112e82e294d759e.tar.bz2
opensim-SC_OLD-c8cd2f18f5af98003b342ca33112e82e294d759e.tar.xz
Mantis #7657: similar fixes for FSAssets.
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/FSAssetService/FSAssetService.cs29
1 files changed, 28 insertions, 1 deletions
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;
35using System.Reflection; 35using System.Reflection;
36using OpenSim.Data; 36using OpenSim.Data;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Serialization.External;
38using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
39using OpenSim.Server.Base; 40using OpenSim.Server.Base;
40using OpenSim.Services.Base; 41using OpenSim.Services.Base;
@@ -394,9 +395,18 @@ namespace OpenSim.Services.FSAssetService
394 } 395 }
395 if (asset == null) 396 if (asset == null)
396 m_missingAssetsFS++; 397 m_missingAssetsFS++;
397 // m_log.InfoFormat("[FSASSETS]: Asset {0}, hash {1} not found in FS", id, hash); 398 // m_log.InfoFormat("[FSASSETS]: Asset {0}, hash {1} not found in FS", id, hash);
398 else 399 else
400 {
401 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
402 // Fix bad assets before sending them elsewhere
403 if (asset.Type == (int)AssetType.Object && asset.Data != null)
404 {
405 string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data));
406 asset.Data = Utils.StringToBytes(xml);
407 }
399 return asset; 408 return asset;
409 }
400 } 410 }
401 411
402 lock (m_statsLock) 412 lock (m_statsLock)
@@ -404,6 +414,15 @@ namespace OpenSim.Services.FSAssetService
404 m_readTicks += Environment.TickCount - startTime; 414 m_readTicks += Environment.TickCount - startTime;
405 m_readCount++; 415 m_readCount++;
406 } 416 }
417
418 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
419 // Fix bad assets before sending them elsewhere
420 if (newAsset.Type == (int)AssetType.Object && newAsset.Data != null)
421 {
422 string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(newAsset.Data));
423 newAsset.Data = Utils.StringToBytes(xml);
424 }
425
407 return newAsset; 426 return newAsset;
408 } 427 }
409 catch (Exception exception) 428 catch (Exception exception)
@@ -519,6 +538,14 @@ namespace OpenSim.Services.FSAssetService
519 538
520 if (!File.Exists(finalFile)) 539 if (!File.Exists(finalFile))
521 { 540 {
541 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
542 // Fix bad assets before storing on this server
543 if (asset.Type == (int)AssetType.Object && asset.Data != null)
544 {
545 string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data));
546 asset.Data = Utils.StringToBytes(xml);
547 }
548
522 FileStream fs = File.Create(tempFile); 549 FileStream fs = File.Create(tempFile);
523 550
524 fs.Write(asset.Data, 0, asset.Data.Length); 551 fs.Write(asset.Data, 0, asset.Data.Length);