From 5f7e392c7cc9410262dfb3333d9b60f6ff26eb79 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 10 Jan 2012 16:26:01 -0800 Subject: [PATCH] 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. --- .../Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 587d260583..edc5ba432a 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -404,6 +404,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver string extension = filename.Substring(i); 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)) { sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];