diff options
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 8 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXAssetData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/PGSQL/PGSQLAssetData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/AssetBase.cs | 16 |
5 files changed, 37 insertions, 17 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 1488e1a..83e7e4c 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -170,6 +170,14 @@ namespace OpenSim.Data.MySQL | |||
170 | } | 170 | } |
171 | 171 | ||
172 | string assetDescription = asset.Description; | 172 | string assetDescription = asset.Description; |
173 | if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) | ||
174 | { | ||
175 | if(asset.Type == (sbyte) AssetType.Landmark) | ||
176 | assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); | ||
177 | else | ||
178 | assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); | ||
179 | } | ||
180 | |||
173 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | 181 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) |
174 | { | 182 | { |
175 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | 183 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); |
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index ec2bcc6..6c6f560 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -214,12 +214,12 @@ namespace OpenSim.Data.MySQL | |||
214 | } | 214 | } |
215 | 215 | ||
216 | string assetDescription = asset.Description; | 216 | string assetDescription = asset.Description; |
217 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | 217 | if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) |
218 | { | 218 | { |
219 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | 219 | if(asset.Type == (sbyte) AssetType.Landmark) |
220 | m_log.WarnFormat( | 220 | assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); |
221 | "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | 221 | else |
222 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | 222 | assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); |
223 | } | 223 | } |
224 | 224 | ||
225 | if (m_enableCompression) | 225 | if (m_enableCompression) |
diff --git a/OpenSim/Data/PGSQL/PGSQLAssetData.cs b/OpenSim/Data/PGSQL/PGSQLAssetData.cs index 81adb03..97ea6a4 100644 --- a/OpenSim/Data/PGSQL/PGSQLAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLAssetData.cs | |||
@@ -175,12 +175,12 @@ namespace OpenSim.Data.PGSQL | |||
175 | } | 175 | } |
176 | 176 | ||
177 | string assetDescription = asset.Description; | 177 | string assetDescription = asset.Description; |
178 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | 178 | if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) |
179 | { | 179 | { |
180 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | 180 | if(asset.Type == (sbyte) AssetType.Landmark) |
181 | m_log.WarnFormat( | 181 | assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); |
182 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | 182 | else |
183 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | 183 | assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); |
184 | } | 184 | } |
185 | 185 | ||
186 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | 186 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) |
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 9c2bd2e..9fbd9c7 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -143,12 +143,12 @@ namespace OpenSim.Data.SQLite | |||
143 | } | 143 | } |
144 | 144 | ||
145 | string assetDescription = asset.Description; | 145 | string assetDescription = asset.Description; |
146 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | 146 | if(assetDescription.Length > AssetBase.MAX_LMASSET_DESC) |
147 | { | 147 | { |
148 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | 148 | if(asset.Type == (sbyte) AssetType.Landmark) |
149 | m_log.WarnFormat( | 149 | assetDescription = assetDescription.Substring(0, AssetBase.MAX_LMASSET_DESC); |
150 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | 150 | else |
151 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | 151 | assetDescription = assetDescription.Substring(0, AssetBase.MAX_ASSET_DESC); |
152 | } | 152 | } |
153 | 153 | ||
154 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | 154 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); |
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 87fd04a..67239ec 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -51,7 +51,8 @@ namespace OpenSim.Framework | |||
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | public static readonly int MAX_ASSET_NAME = 64; | 53 | public static readonly int MAX_ASSET_NAME = 64; |
54 | public static readonly int MAX_ASSET_DESC = 64; | 54 | public static readonly int MAX_ASSET_DESC = 127; |
55 | public static readonly int MAX_LMASSET_DESC = 255; | ||
55 | 56 | ||
56 | /// <summary> | 57 | /// <summary> |
57 | /// Data of the Asset | 58 | /// Data of the Asset |
@@ -305,7 +306,18 @@ namespace OpenSim.Framework | |||
305 | public string Description | 306 | public string Description |
306 | { | 307 | { |
307 | get { return m_description; } | 308 | get { return m_description; } |
308 | set { m_description = value; } | 309 | set |
310 | { | ||
311 | if(value.Length > AssetBase.MAX_LMASSET_DESC) | ||
312 | { | ||
313 | if(m_type == (sbyte) AssetType.Landmark) | ||
314 | m_description = value.Substring(0, AssetBase.MAX_LMASSET_DESC); | ||
315 | else | ||
316 | m_description = value.Substring(0, AssetBase.MAX_ASSET_DESC); | ||
317 | } | ||
318 | else | ||
319 | m_description = value; | ||
320 | } | ||
309 | } | 321 | } |
310 | 322 | ||
311 | public DateTime CreationDate | 323 | public DateTime CreationDate |