mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
On uploads, throw exception only if there's an attached debugger.
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -94,7 +95,7 @@ namespace DiscImageChef.Core
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
throw;
|
if(Debugger.IsAttached) throw;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -155,7 +156,7 @@ namespace DiscImageChef.Core
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
throw;
|
if(Debugger.IsAttached) throw;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -90,13 +91,13 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
throw;
|
if(Debugger.IsAttached) throw;
|
||||||
#else
|
#endif
|
||||||
response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain");
|
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
|
||||||
return response;
|
return response;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server
|
/// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -109,12 +110,12 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpRequest request = HttpContext.Current.Request;
|
HttpRequest request = HttpContext.Current.Request;
|
||||||
|
|
||||||
StreamReader sr = new StreamReader(request.InputStream);
|
StreamReader sr = new StreamReader(request.InputStream);
|
||||||
string jsonData = sr.ReadToEnd();
|
string jsonData = sr.ReadToEnd();
|
||||||
DeviceReportV2 newReport = JsonConvert.DeserializeObject<DeviceReportV2>(jsonData);
|
DeviceReportV2 newReport = JsonConvert.DeserializeObject<DeviceReportV2>(jsonData);
|
||||||
|
|
||||||
if(newReport == null)
|
if(newReport == null)
|
||||||
{
|
{
|
||||||
response.Content = new StringContent("notstats", Encoding.UTF8, "text/plain");
|
response.Content = new StringContent("notstats", Encoding.UTF8, "text/plain");
|
||||||
@@ -143,11 +144,10 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
throw;
|
if(Debugger.IsAttached) throw;
|
||||||
#else
|
#endif
|
||||||
response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain");
|
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
|
||||||
return response;
|
return response;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
@@ -158,9 +159,7 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
{
|
{
|
||||||
addNvs = new OsStats
|
addNvs = new OsStats
|
||||||
{
|
{
|
||||||
name = oldNvs.name,
|
name = oldNvs.name, Value = oldNvs.Value + 1, version = oldNvs.version
|
||||||
Value = oldNvs.Value + 1,
|
|
||||||
version = oldNvs.version
|
|
||||||
};
|
};
|
||||||
removeNvs = oldNvs;
|
removeNvs = oldNvs;
|
||||||
break;
|
break;
|
||||||
@@ -188,10 +187,9 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
oldStats.Versions.Where(oldNvs => oldNvs.name == newNvs.name))
|
oldStats.Versions.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||||
{
|
{
|
||||||
addNvs = new NameValueStats
|
addNvs = new NameValueStats
|
||||||
{
|
{
|
||||||
name = oldNvs.name,
|
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||||
Value = oldNvs.Value + newNvs.Value
|
};
|
||||||
};
|
|
||||||
removeNvs = oldNvs;
|
removeNvs = oldNvs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -242,10 +240,9 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
oldStats.Filesystems.Where(oldNvs => oldNvs.name == newNvs.name))
|
oldStats.Filesystems.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||||
{
|
{
|
||||||
addNvs = new NameValueStats
|
addNvs = new NameValueStats
|
||||||
{
|
{
|
||||||
name = oldNvs.name,
|
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||||
Value = oldNvs.Value + newNvs.Value
|
};
|
||||||
};
|
|
||||||
removeNvs = oldNvs;
|
removeNvs = oldNvs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -271,10 +268,9 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
oldStats.Partitions.Where(oldNvs => oldNvs.name == newNvs.name))
|
oldStats.Partitions.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||||
{
|
{
|
||||||
addNvs = new NameValueStats
|
addNvs = new NameValueStats
|
||||||
{
|
{
|
||||||
name = oldNvs.name,
|
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||||
Value = oldNvs.Value + newNvs.Value
|
};
|
||||||
};
|
|
||||||
removeNvs = oldNvs;
|
removeNvs = oldNvs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -300,10 +296,9 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
oldStats.MediaImages.Where(oldNvs => oldNvs.name == newNvs.name))
|
oldStats.MediaImages.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||||
{
|
{
|
||||||
addNvs = new NameValueStats
|
addNvs = new NameValueStats
|
||||||
{
|
{
|
||||||
name = oldNvs.name,
|
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||||
Value = oldNvs.Value + newNvs.Value
|
};
|
||||||
};
|
|
||||||
removeNvs = oldNvs;
|
removeNvs = oldNvs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -329,10 +324,9 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
oldStats.Filters.Where(oldNvs => oldNvs.name == newNvs.name))
|
oldStats.Filters.Where(oldNvs => oldNvs.name == newNvs.name))
|
||||||
{
|
{
|
||||||
addNvs = new NameValueStats
|
addNvs = new NameValueStats
|
||||||
{
|
{
|
||||||
name = oldNvs.name,
|
name = oldNvs.name, Value = oldNvs.Value + newNvs.Value
|
||||||
Value = oldNvs.Value + newNvs.Value
|
};
|
||||||
};
|
|
||||||
removeNvs = oldNvs;
|
removeNvs = oldNvs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -469,12 +463,10 @@ namespace DiscImageChef.Server.Controllers
|
|||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
System.Console.WriteLine("{0} {1}", ex.Message, ex.InnerException);
|
if(Debugger.IsAttached) throw;
|
||||||
throw;
|
#endif
|
||||||
#else
|
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
|
||||||
response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain");
|
|
||||||
return response;
|
return response;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user