aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/FSAssetService/FSAssetService.cs
diff options
context:
space:
mode:
authorUbitUmarov2018-11-12 20:46:11 +0000
committerUbitUmarov2018-11-12 20:46:11 +0000
commit7fcb3fdf11083912a1968a3093bdb452f06209f0 (patch)
tree21f86d86ce32accaf4029ec3bdb70f862c7a7d4b /OpenSim/Services/FSAssetService/FSAssetService.cs
parentfix a http error response (diff)
downloadopensim-SC-7fcb3fdf11083912a1968a3093bdb452f06209f0.zip
opensim-SC-7fcb3fdf11083912a1968a3093bdb452f06209f0.tar.gz
opensim-SC-7fcb3fdf11083912a1968a3093bdb452f06209f0.tar.bz2
opensim-SC-7fcb3fdf11083912a1968a3093bdb452f06209f0.tar.xz
FSAssets: truncate assets name and description to max size
Diffstat (limited to 'OpenSim/Services/FSAssetService/FSAssetService.cs')
-rw-r--r--OpenSim/Services/FSAssetService/FSAssetService.cs19
1 files changed, 18 insertions, 1 deletions
diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs
index ca2f459..028dd01 100644
--- a/OpenSim/Services/FSAssetService/FSAssetService.cs
+++ b/OpenSim/Services/FSAssetService/FSAssetService.cs
@@ -329,7 +329,6 @@ namespace OpenSim.Services.FSAssetService
329 using (GZipStream gz = new GZipStream(new FileStream(diskFile + ".gz", FileMode.Create), CompressionMode.Compress)) 329 using (GZipStream gz = new GZipStream(new FileStream(diskFile + ".gz", FileMode.Create), CompressionMode.Compress))
330 { 330 {
331 gz.Write(data, 0, data.Length); 331 gz.Write(data, 0, data.Length);
332 gz.Close();
333 } 332 }
334 File.Delete(files[i]); 333 File.Delete(files[i]);
335 334
@@ -620,6 +619,24 @@ namespace OpenSim.Services.FSAssetService
620 int tickCount = Environment.TickCount; 619 int tickCount = Environment.TickCount;
621 string hash = GetSHA256Hash(asset.Data); 620 string hash = GetSHA256Hash(asset.Data);
622 621
622 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
623 {
624 string assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
625 m_log.WarnFormat(
626 "[FSASSETS]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
627 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
628 asset.Name = assetName;
629 }
630
631 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
632 {
633 string assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
634 m_log.WarnFormat(
635 "[FSASSETS]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
636 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
637 asset.Description = assetDescription;
638 }
639
623 if (!AssetExists(hash)) 640 if (!AssetExists(hash))
624 { 641 {
625 string tempFile = Path.Combine(Path.Combine(m_SpoolDirectory, "spool"), hash + ".asset"); 642 string tempFile = Path.Combine(Path.Combine(m_SpoolDirectory, "spool"), hash + ".asset");