mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
FSAssets: truncate assets name and description to max size
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user