Add a check to see if an asset exists before recreating it while

loading an archive. This does add an extra roundtrip to the asset
server if loading new assets but it protects against overwriting
(and potentially corrupting) existing assets.
iar_mods
Mic Bowman 2012-01-10 16:26:01 -08:00
parent 53fb20880c
commit 5f7e392c7c
1 changed files with 6 additions and 0 deletions

View File

@ -404,6 +404,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
string extension = filename.Substring(i); string extension = filename.Substring(i);
string uuid = filename.Remove(filename.Length - extension.Length); string uuid = filename.Remove(filename.Length - extension.Length);
if (m_scene.AssetService.GetMetadata(uuid) != null)
{
// m_log.DebugFormat("[ARCHIVER]: found existing asset {0}",uuid);
return true;
}
if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension))
{ {
sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];