diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index ce7039616c..f94375d513 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -160,18 +160,18 @@ namespace OpenSim.Data.MSSQL @temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)"; string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index c96139df75..f03e322f5d 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -171,18 +171,18 @@ namespace OpenSim.Data.MySQL dbcon)) { string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 1bf6a9a1db..430bb9fcb4 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -210,18 +210,18 @@ namespace OpenSim.Data.MySQL using (MySqlTransaction transaction = dbcon.BeginTransaction()) { string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Data/PGSQL/PGSQLAssetData.cs b/OpenSim/Data/PGSQL/PGSQLAssetData.cs index ca18dc9604..5d8b0a2c18 100644 --- a/OpenSim/Data/PGSQL/PGSQLAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLAssetData.cs @@ -166,18 +166,18 @@ namespace OpenSim.Data.PGSQL "; string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 2834bcfaba..f0dda64699 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -134,18 +134,18 @@ namespace OpenSim.Data.SQLite override public void StoreAsset(AssetBase asset) { string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index d2c6c57ac3..153a1d0caf 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -50,6 +50,9 @@ namespace OpenSim.Framework { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public static readonly int MAX_ASSET_NAME = 64; + public static readonly int MAX_ASSET_DESC = 64; + /// /// Data of the Asset /// diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 9d77b19f7f..4bced548b5 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -514,6 +514,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture scene.RegionInfo.RegionID.ToString()); asset.Data = assetData; asset.Description = String.Format("URL image : {0}", Url); + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) + asset.Description = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); asset.Local = false; asset.Temporary = ((Disp & DISP_TEMP) != 0); scene.AssetService.Store(asset);