diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs index ca2f459339..028dd0158f 100644 --- a/OpenSim/Services/FSAssetService/FSAssetService.cs +++ b/OpenSim/Services/FSAssetService/FSAssetService.cs @@ -329,7 +329,6 @@ namespace OpenSim.Services.FSAssetService using (GZipStream gz = new GZipStream(new FileStream(diskFile + ".gz", FileMode.Create), CompressionMode.Compress)) { gz.Write(data, 0, data.Length); - gz.Close(); } File.Delete(files[i]); @@ -620,6 +619,24 @@ namespace OpenSim.Services.FSAssetService int tickCount = Environment.TickCount; string hash = GetSHA256Hash(asset.Data); + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) + { + string assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); + m_log.WarnFormat( + "[FSASSETS]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", + asset.Name, asset.ID, asset.Name.Length, assetName.Length); + asset.Name = assetName; + } + + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) + { + string assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); + m_log.WarnFormat( + "[FSASSETS]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", + asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); + asset.Description = assetDescription; + } + if (!AssetExists(hash)) { string tempFile = Path.Combine(Path.Combine(m_SpoolDirectory, "spool"), hash + ".asset");