aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService/HGAssetService.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/HypergridService/HGAssetService.cs34
1 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs
index 84dec8d..b83fb1e 100644
--- a/OpenSim/Services/HypergridService/HGAssetService.cs
+++ b/OpenSim/Services/HypergridService/HGAssetService.cs
@@ -76,10 +76,10 @@ namespace OpenSim.Services.HypergridService
76 if (m_UserAccountService == null) 76 if (m_UserAccountService == null)
77 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); 77 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
78 78
79 // legacy configuration [obsolete] 79 m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI",
80 m_HomeURL = assetConfig.GetString("ProfileServerURI", string.Empty); 80 new string[] { "Startup", "Hypergrid", configName }, string.Empty);
81 // Preferred 81 if (m_HomeURL == string.Empty)
82 m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); 82 throw new Exception("[HGAssetService] No HomeURI specified");
83 83
84 m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); 84 m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
85 85
@@ -100,7 +100,7 @@ namespace OpenSim.Services.HypergridService
100 return null; 100 return null;
101 101
102 if (asset.Metadata.Type == (sbyte)AssetType.Object) 102 if (asset.Metadata.Type == (sbyte)AssetType.Object)
103 asset.Data = AdjustIdentifiers(asset.Data); ; 103 asset.Data = AdjustIdentifiers(asset.Data);
104 104
105 AdjustIdentifiers(asset.Metadata); 105 AdjustIdentifiers(asset.Metadata);
106 106
@@ -129,6 +129,14 @@ namespace OpenSim.Services.HypergridService
129 if (!m_AssetPerms.AllowedExport(asset.Type)) 129 if (!m_AssetPerms.AllowedExport(asset.Type))
130 return null; 130 return null;
131 131
132 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
133 // Fix bad assets before sending them elsewhere
134 if (asset.Type == (int)AssetType.Object && asset.Data != null)
135 {
136 string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data));
137 asset.Data = Utils.StringToBytes(xml);
138 }
139
132 return asset.Data; 140 return asset.Data;
133 } 141 }
134 142
@@ -139,6 +147,14 @@ namespace OpenSim.Services.HypergridService
139 if (!m_AssetPerms.AllowedImport(asset.Type)) 147 if (!m_AssetPerms.AllowedImport(asset.Type))
140 return string.Empty; 148 return string.Empty;
141 149
150 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
151 // Fix bad assets before storing on this server
152 if (asset.Type == (int)AssetType.Object && asset.Data != null)
153 {
154 string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data));
155 asset.Data = Utils.StringToBytes(xml);
156 }
157
142 return base.Store(asset); 158 return base.Store(asset);
143 } 159 }
144 160
@@ -160,10 +176,16 @@ namespace OpenSim.Services.HypergridService
160 meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; 176 meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName;
161 } 177 }
162 178
179 // Only for Object
163 protected byte[] AdjustIdentifiers(byte[] data) 180 protected byte[] AdjustIdentifiers(byte[] data)
164 { 181 {
165 string xml = Utils.BytesToString(data); 182 string xml = Utils.BytesToString(data);
166 return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, m_HomeURL, m_Cache, UUID.Zero)); 183
184 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
185 // Fix bad assets before sending them elsewhere
186 xml = ExternalRepresentationUtils.SanitizeXml(xml);
187
188 return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero));
167 } 189 }
168 190
169 } 191 }