Browse Source

add some broken assets check/log, so i don't try to fix other code using one

UbitUmarov 3 năm trước cách đây
mục cha
commit
f69f0281cf
1 tập tin đã thay đổi với 16 bổ sung2 xóa
  1. 16 2
      OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs

+ 16 - 2
OpenSim/Capabilities/Handlers/GetAssets/GetAssetsHandler.cs

@@ -114,7 +114,7 @@ namespace OpenSim.Capabilities.Handlers
                 return;
             }
 
-            if (String.IsNullOrEmpty(assetStr))
+            if (string.IsNullOrEmpty(assetStr))
                 return;
 
             UUID assetID = UUID.Zero;
@@ -122,13 +122,27 @@ namespace OpenSim.Capabilities.Handlers
                 return;
 
             AssetBase asset = m_assetService.Get(assetID.ToString(), serviceURL, false);
-            if (asset == null || asset.Type != (sbyte)type)
+            if (asset == null)
             {
                 // m_log.Warn("[GETASSET]: not found: " + query + " " + assetStr);
                 response.StatusCode = (int)HttpStatusCode.NotFound;
                 return;
             }
 
+            if (asset.Type != (sbyte)type)
+            {
+                m_log.Warn("[GETASSET]: asset with wrong type: " + assetStr + " " + asset.Type.ToString() + " != " + ((sbyte)type).ToString());
+                response.StatusCode = (int)HttpStatusCode.NotFound;
+                return;
+            }
+
+            if (asset.Data.Length == 0)
+            {
+                m_log.Warn("[GETASSET]: asset with empty data: " + assetStr +" type " + asset.Type.ToString());
+                response.StatusCode = (int)HttpStatusCode.NotFound;
+                return;
+            }
+
             int len = asset.Data.Length;
 
             string range = null;