In the asset service, check that an asset exists before attempting to store it.
parent
4a9b8184f7
commit
6b51d8a10e
|
@ -251,12 +251,14 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// check if the asset UUID exist in database
|
||||
/// Check if the asset exists in the database
|
||||
/// </summary>
|
||||
/// <param name="uuid">The asset UUID</param>
|
||||
/// <returns>true if exist.</returns>
|
||||
/// <returns>true if it exists, false otherwise.</returns>
|
||||
override public bool ExistsAsset(UUID uuid)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
|
||||
|
||||
bool assetExists = false;
|
||||
|
||||
lock (m_dbLock)
|
||||
|
@ -273,9 +275,12 @@ namespace OpenSim.Data.MySQL
|
|||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if (dbReader.Read())
|
||||
{
|
||||
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
|
||||
assetExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
|
|
|
@ -174,10 +174,12 @@ namespace OpenSim.Services.AssetService
|
|||
|
||||
public virtual string Store(AssetBase asset)
|
||||
{
|
||||
if (!m_Database.ExistsAsset(asset.FullID))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length);
|
||||
|
||||
// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
|
||||
m_Database.StoreAsset(asset);
|
||||
}
|
||||
|
||||
return asset.ID;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue