some cleanup

0.9.1.0-post-fixes
UbitUmarov 2018-07-14 14:22:52 +01:00
parent 770f59ff87
commit f17b48e73e
1 changed files with 27 additions and 31 deletions

View File

@ -132,8 +132,6 @@ namespace OpenSim.Capabilities.Handlers
private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format) private bool FetchTexture(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID textureID, string format)
{ {
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format); // m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
AssetBase texture;
if(!String.IsNullOrEmpty(m_RedirectURL)) if(!String.IsNullOrEmpty(m_RedirectURL))
{ {
string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString(); string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString();
@ -142,26 +140,26 @@ namespace OpenSim.Capabilities.Handlers
httpResponse.RedirectLocation = textureUrl; httpResponse.RedirectLocation = textureUrl;
return true; return true;
} }
else // no redirect
// Fetch, Misses or invalid return a 404
AssetBase texture = m_assetService.Get(textureID.ToString());
if (texture != null)
{ {
texture = m_assetService.Get(textureID.ToString()); if (texture.Type != (sbyte)AssetType.Texture)
if(texture != null)
{
if(texture.Type != (sbyte)AssetType.Texture)
{ {
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return true; return true;
} }
if(format == DefaultFormat) if (format == DefaultFormat)
{ {
WriteTextureData(httpRequest, httpResponse, texture, format); WriteTextureData(httpRequest, httpResponse, texture, format);
return true; return true;
} }
else
{ // need to convert format
AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID); AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
newTexture.Data = ConvertTextureData(texture, format); newTexture.Data = ConvertTextureData(texture, format);
if(newTexture.Data.Length == 0) if (newTexture.Data.Length == 0)
return false; // !!! Caller try another codec, please! return false; // !!! Caller try another codec, please!
newTexture.Flags = AssetFlags.Collectable; newTexture.Flags = AssetFlags.Collectable;
@ -170,8 +168,6 @@ namespace OpenSim.Capabilities.Handlers
WriteTextureData(httpRequest, httpResponse, newTexture, format); WriteTextureData(httpRequest, httpResponse, newTexture, format);
return true; return true;
} }
}
}
// not found // not found
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); // m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");