aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs90
1 files changed, 45 insertions, 45 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs
index 0acef1d..94a786e 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestFileServices.cs
@@ -202,27 +202,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
202 { 202 {
203 try 203 try
204 { 204 {
205 path = rdata.path.Substring(rdata.Parameters[0].Length+qPrefix.Length+2); 205 path = rdata.path.Substring(rdata.Parameters[0].Length+qPrefix.Length+2);
206 if(File.Exists(path)) 206 if (File.Exists(path))
207 { 207 {
208 Rest.Log.DebugFormat("{0} File located <{1}>", MsgId, path); 208 Rest.Log.DebugFormat("{0} File located <{1}>", MsgId, path);
209 Byte[] data = File.ReadAllBytes(path); 209 Byte[] data = File.ReadAllBytes(path);
210 rdata.initXmlWriter(); 210 rdata.initXmlWriter();
211 rdata.writer.WriteStartElement(String.Empty,"File",String.Empty); 211 rdata.writer.WriteStartElement(String.Empty,"File",String.Empty);
212 rdata.writer.WriteAttributeString("name", path); 212 rdata.writer.WriteAttributeString("name", path);
213 rdata.writer.WriteBase64(data,0,data.Length); 213 rdata.writer.WriteBase64(data,0,data.Length);
214 rdata.writer.WriteFullEndElement(); 214 rdata.writer.WriteFullEndElement();
215 } 215 }
216 else 216 else
217 { 217 {
218 Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, path); 218 Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, path);
219 rdata.Fail(Rest.HttpStatusCodeNotFound, String.Format("invalid parameters : {0}", path)); 219 rdata.Fail(Rest.HttpStatusCodeNotFound, String.Format("invalid parameters : {0}", path));
220 } 220 }
221 } 221 }
222 catch (Exception e) 222 catch (Exception e)
223 { 223 {
224 Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, e.Message); 224 Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, e.Message);
225 rdata.Fail(Rest.HttpStatusCodeNotFound, String.Format("invalid parameters : {0} {1}", 225 rdata.Fail(Rest.HttpStatusCodeNotFound, String.Format("invalid parameters : {0} {1}",
226 path, e.Message)); 226 path, e.Message));
227 } 227 }
228 } 228 }
@@ -249,21 +249,21 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
249 { 249 {
250 try 250 try
251 { 251 {
252 path = rdata.path.Substring(rdata.Parameters[0].Length+qPrefix.Length+2); 252 path = rdata.path.Substring(rdata.Parameters[0].Length+qPrefix.Length+2);
253 bool maymod = File.Exists(path); 253 bool maymod = File.Exists(path);
254 254
255 rdata.initXmlReader(); 255 rdata.initXmlReader();
256 XmlReader xml = rdata.reader; 256 XmlReader xml = rdata.reader;
257 257
258 if (!xml.ReadToFollowing("File")) 258 if (!xml.ReadToFollowing("File"))
259 { 259 {
260 Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path); 260 Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path);
261 rdata.Fail(Rest.HttpStatusCodeBadRequest,"invalid request data"); 261 rdata.Fail(Rest.HttpStatusCodeBadRequest,"invalid request data");
262 } 262 }
263 263
264 Byte[] data = Convert.FromBase64String(xml.ReadElementContentAsString("File", "")); 264 Byte[] data = Convert.FromBase64String(xml.ReadElementContentAsString("File", ""));
265 265
266 File.WriteAllBytes(path,data); 266 File.WriteAllBytes(path,data);
267 modified = maymod; 267 modified = maymod;
268 created = ! maymod; 268 created = ! maymod;
269 } 269 }
@@ -319,21 +319,21 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
319 { 319 {
320 try 320 try
321 { 321 {
322 path = rdata.path.Substring(rdata.Parameters[0].Length+qPrefix.Length+2); 322 path = rdata.path.Substring(rdata.Parameters[0].Length+qPrefix.Length+2);
323 bool maymod = File.Exists(path); 323 bool maymod = File.Exists(path);
324 324
325 rdata.initXmlReader(); 325 rdata.initXmlReader();
326 XmlReader xml = rdata.reader; 326 XmlReader xml = rdata.reader;
327 327
328 if (!xml.ReadToFollowing("File")) 328 if (!xml.ReadToFollowing("File"))
329 { 329 {
330 Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path); 330 Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path);
331 rdata.Fail(Rest.HttpStatusCodeBadRequest,"invalid request data"); 331 rdata.Fail(Rest.HttpStatusCodeBadRequest,"invalid request data");
332 } 332 }
333 333
334 Byte[] data = Convert.FromBase64String(xml.ReadElementContentAsString("File", "")); 334 Byte[] data = Convert.FromBase64String(xml.ReadElementContentAsString("File", ""));
335 335
336 File.WriteAllBytes(path,data); 336 File.WriteAllBytes(path,data);
337 modified = maymod; 337 modified = maymod;
338 created = ! maymod; 338 created = ! maymod;
339 } 339 }
@@ -389,12 +389,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
389 { 389 {
390 try 390 try
391 { 391 {
392 path = rdata.path.Substring(rdata.Parameters[0].Length+qPrefix.Length+2); 392 path = rdata.path.Substring(rdata.Parameters[0].Length+qPrefix.Length+2);
393 393
394 if(File.Exists(path)) 394 if (File.Exists(path))
395 { 395 {
396 File.Delete(path); 396 File.Delete(path);
397 } 397 }
398 } 398 }
399 catch (Exception e) 399 catch (Exception e)
400 { 400 {