Mantis #7657: similar fixes for FSAssets.
parent
e5a1243abc
commit
c8cd2f18f5
|
@ -35,6 +35,7 @@ using System.Threading;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Server.Base;
|
||||||
using OpenSim.Services.Base;
|
using OpenSim.Services.Base;
|
||||||
|
@ -394,9 +395,18 @@ namespace OpenSim.Services.FSAssetService
|
||||||
}
|
}
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
m_missingAssetsFS++;
|
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
|
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;
|
return asset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_statsLock)
|
lock (m_statsLock)
|
||||||
|
@ -404,6 +414,15 @@ namespace OpenSim.Services.FSAssetService
|
||||||
m_readTicks += Environment.TickCount - startTime;
|
m_readTicks += Environment.TickCount - startTime;
|
||||||
m_readCount++;
|
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;
|
return newAsset;
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
@ -519,6 +538,14 @@ namespace OpenSim.Services.FSAssetService
|
||||||
|
|
||||||
if (!File.Exists(finalFile))
|
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);
|
FileStream fs = File.Create(tempFile);
|
||||||
|
|
||||||
fs.Write(asset.Data, 0, asset.Data.Length);
|
fs.Write(asset.Data, 0, asset.Data.Length);
|
||||||
|
|
|
@ -926,6 +926,7 @@
|
||||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
|
<Reference name="OpenSim.Framework.Serialization"/>
|
||||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||||
<Reference name="OpenSim.Server.Base"/>
|
<Reference name="OpenSim.Server.Base"/>
|
||||||
<Reference name="OpenSim.Services.Interfaces"/>
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
|
|
Loading…
Reference in New Issue