diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 46 |
2 files changed, 45 insertions, 12 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 6437d0b..f667b8f 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -176,8 +176,17 @@ namespace OpenSim.Capabilities.Handlers | |||
176 | return true; | 176 | return true; |
177 | } | 177 | } |
178 | 178 | ||
179 | response = new Hashtable(); | ||
180 | |||
181 | response["int_response_code"] = 404; | ||
182 | response["str_response_string"] = "not found"; | ||
183 | response["content_type"] = "text/plain"; | ||
184 | response["keepalive"] = false; | ||
185 | response["reusecontext"] = false; | ||
186 | response["int_bytes"] = 0; | ||
187 | //WriteTextureData(request,response,null,format); | ||
179 | // not found | 188 | // not found |
180 | // m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); | 189 | //m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found"); |
181 | return true; | 190 | return true; |
182 | } | 191 | } |
183 | 192 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 51c8c7e..7c2f8ed 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1821,17 +1821,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1821 | { | 1821 | { |
1822 | UUID assetID = UUID.Zero; | 1822 | UUID assetID = UUID.Zero; |
1823 | 1823 | ||
1824 | if (!UUID.TryParse(notecardNameOrUuid, out assetID)) | 1824 | bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID); |
1825 | |||
1826 | if (!notecardNameIsUUID) | ||
1825 | { | 1827 | { |
1826 | m_host.TaskInventory.LockItemsForRead(true); | 1828 | assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); |
1827 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
1828 | { | ||
1829 | if (item.Type == 7 && item.Name == notecardNameOrUuid) | ||
1830 | { | ||
1831 | assetID = item.AssetID; | ||
1832 | } | ||
1833 | } | ||
1834 | m_host.TaskInventory.LockItemsForRead(false); | ||
1835 | } | 1829 | } |
1836 | 1830 | ||
1837 | if (assetID == UUID.Zero) | 1831 | if (assetID == UUID.Zero) |
@@ -1842,7 +1836,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1842 | AssetBase a = World.AssetService.Get(assetID.ToString()); | 1836 | AssetBase a = World.AssetService.Get(assetID.ToString()); |
1843 | 1837 | ||
1844 | if (a == null) | 1838 | if (a == null) |
1845 | return UUID.Zero; | 1839 | { |
1840 | // Whoops, it's still possible here that the notecard name was properly | ||
1841 | // formatted like a UUID but isn't an asset UUID so lets look it up by name after all | ||
1842 | assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); | ||
1843 | if (assetID == UUID.Zero) | ||
1844 | return UUID.Zero; | ||
1845 | |||
1846 | if (!NotecardCache.IsCached(assetID)) | ||
1847 | { | ||
1848 | a = World.AssetService.Get(assetID.ToString()); | ||
1849 | |||
1850 | if (a == null) | ||
1851 | { | ||
1852 | return UUID.Zero; | ||
1853 | } | ||
1854 | } | ||
1855 | } | ||
1846 | 1856 | ||
1847 | string data = Encoding.UTF8.GetString(a.Data); | 1857 | string data = Encoding.UTF8.GetString(a.Data); |
1848 | NotecardCache.Cache(assetID, data); | 1858 | NotecardCache.Cache(assetID, data); |
@@ -1850,6 +1860,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1850 | 1860 | ||
1851 | return assetID; | 1861 | return assetID; |
1852 | } | 1862 | } |
1863 | protected UUID SearchTaskInventoryForAssetId(string name) | ||
1864 | { | ||
1865 | UUID assetId = UUID.Zero; | ||
1866 | m_host.TaskInventory.LockItemsForRead(true); | ||
1867 | foreach (TaskInventoryItem item in m_host.TaskInventory.Values) | ||
1868 | { | ||
1869 | if (item.Type == 7 && item.Name == name) | ||
1870 | { | ||
1871 | assetId = item.AssetID; | ||
1872 | } | ||
1873 | } | ||
1874 | m_host.TaskInventory.LockItemsForRead(false); | ||
1875 | return assetId; | ||
1876 | } | ||
1853 | 1877 | ||
1854 | /// <summary> | 1878 | /// <summary> |
1855 | /// Directly get an entire notecard at once. | 1879 | /// Directly get an entire notecard at once. |