diff options
Diffstat (limited to 'Duplicati/Server/WebServer')
9 files changed, 17 insertions, 17 deletions
diff --git a/Duplicati/Server/WebServer/IndexHtmlHandler.cs b/Duplicati/Server/WebServer/IndexHtmlHandler.cs index 6d3e4e53b..b5680e432 100644 --- a/Duplicati/Server/WebServer/IndexHtmlHandler.cs +++ b/Duplicati/Server/WebServer/IndexHtmlHandler.cs @@ -66,7 +66,7 @@ namespace Duplicati.Server.WebServer private string GetPath(Uri uri)
{
- if (ForbiddenChars.Where(x => uri.AbsolutePath.Contains(x)).Any())
+ if (ForbiddenChars.Any(x => uri.AbsolutePath.Contains(x)))
throw new BadRequestException("Illegal path");
var uripath = Uri.UnescapeDataString(uri.AbsolutePath);
while(uripath.Length > 0 && (uripath.StartsWith("/", StringComparison.Ordinal) || uripath.StartsWith(DirSep, StringComparison.Ordinal)))
diff --git a/Duplicati/Server/WebServer/RESTMethods/Backup.cs b/Duplicati/Server/WebServer/RESTMethods/Backup.cs index 5079b4637..a7f6d1460 100644 --- a/Duplicati/Server/WebServer/RESTMethods/Backup.cs +++ b/Duplicati/Server/WebServer/RESTMethods/Backup.cs @@ -284,10 +284,10 @@ namespace Duplicati.Server.WebServer.RESTMethods {
// Already running
}
- else if (Program.WorkThread.CurrentTasks.Where(x => {
+ else if (Program.WorkThread.CurrentTasks.Any(x => {
var bn = x == null ? null : x.Backup;
return bn == null || bn.ID == backup.ID;
- }).Any())
+ }))
{
// Already in queue
}
@@ -309,11 +309,11 @@ namespace Duplicati.Server.WebServer.RESTMethods info.OutputOK(new { Status = "OK", Active = true });
return;
}
- else if (Program.WorkThread.CurrentTasks.Where(x =>
+ else if (Program.WorkThread.CurrentTasks.Any(x =>
{
var bn = x == null ? null : x.Backup;
return bn == null || bn.ID == backup.ID;
- }).Any())
+ }))
{
info.OutputOK(new { Status = "OK", Active = true });
return;
@@ -539,7 +539,7 @@ namespace Duplicati.Server.WebServer.RESTMethods return;
}
- if (Program.DataConnection.Backups.Where(x => x.Name.Equals(data.Backup.Name, StringComparison.OrdinalIgnoreCase) && x.ID != data.Backup.ID).Any())
+ if (Program.DataConnection.Backups.Any(x => x.Name.Equals(data.Backup.Name, StringComparison.OrdinalIgnoreCase) && x.ID != data.Backup.ID))
{
info.ReportClientError("There already exists a backup with the name: " + data.Backup.Name, System.Net.HttpStatusCode.Conflict);
return;
diff --git a/Duplicati/Server/WebServer/RESTMethods/Backups.cs b/Duplicati/Server/WebServer/RESTMethods/Backups.cs index 82c9dc1a3..db0b3bb7e 100644 --- a/Duplicati/Server/WebServer/RESTMethods/Backups.cs +++ b/Duplicati/Server/WebServer/RESTMethods/Backups.cs @@ -113,10 +113,10 @@ namespace Duplicati.Server.WebServer.RESTMethods {
var basename = ipx.Backup.Name;
var c = 0;
- while (c++ < 100 && Program.DataConnection.Backups.Where(x => x.Name.Equals(ipx.Backup.Name, StringComparison.OrdinalIgnoreCase)).Any())
+ while (c++ < 100 && Program.DataConnection.Backups.Any(x => x.Name.Equals(ipx.Backup.Name, StringComparison.OrdinalIgnoreCase)))
ipx.Backup.Name = basename + " (" + c.ToString() + ")";
- if (Program.DataConnection.Backups.Where(x => x.Name.Equals(ipx.Backup.Name, StringComparison.OrdinalIgnoreCase)).Any())
+ if (Program.DataConnection.Backups.Any(x => x.Name.Equals(ipx.Backup.Name, StringComparison.OrdinalIgnoreCase)))
{
info.BodyWriter.SetOK();
info.Response.ContentType = "text/html";
@@ -204,7 +204,7 @@ namespace Duplicati.Server.WebServer.RESTMethods lock(Program.DataConnection.m_lock)
{
- if (Program.DataConnection.Backups.Where(x => x.Name.Equals(data.Backup.Name, StringComparison.OrdinalIgnoreCase)).Any())
+ if (Program.DataConnection.Backups.Any(x => x.Name.Equals(data.Backup.Name, StringComparison.OrdinalIgnoreCase)))
{
info.ReportClientError("There already exists a backup with the name: " + data.Backup.Name, System.Net.HttpStatusCode.Conflict);
return;
diff --git a/Duplicati/Server/WebServer/RESTMethods/BugReport.cs b/Duplicati/Server/WebServer/RESTMethods/BugReport.cs index ac9b8cc95..61aef7a55 100644 --- a/Duplicati/Server/WebServer/RESTMethods/BugReport.cs +++ b/Duplicati/Server/WebServer/RESTMethods/BugReport.cs @@ -26,7 +26,7 @@ namespace Duplicati.Server.WebServer.RESTMethods long id;
long.TryParse(key, out id);
- var tf = Program.DataConnection.GetTempFiles().Where(x => x.ID == id).FirstOrDefault();
+ var tf = Program.DataConnection.GetTempFiles().FirstOrDefault(x => x.ID == id);
if (tf == null)
{
info.ReportClientError("Invalid or missing bugreport id", System.Net.HttpStatusCode.NotFound);
diff --git a/Duplicati/Server/WebServer/RESTMethods/Filesystem.cs b/Duplicati/Server/WebServer/RESTMethods/Filesystem.cs index a69a9b547..ad085271b 100644 --- a/Duplicati/Server/WebServer/RESTMethods/Filesystem.cs +++ b/Duplicati/Server/WebServer/RESTMethods/Filesystem.cs @@ -55,7 +55,7 @@ namespace Duplicati.Server.WebServer.RESTMethods if (ix > 0)
{
var tk = path.Substring(0, ix + 1);
- var node = SpecialFolders.Nodes.Where(x => x.id.Equals(tk, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
+ var node = SpecialFolders.Nodes.FirstOrDefault(x => x.id.Equals(tk, StringComparison.OrdinalIgnoreCase));
if (node != null)
{
specialpath = node.resolvedpath;
diff --git a/Duplicati/Server/WebServer/RESTMethods/Notification.cs b/Duplicati/Server/WebServer/RESTMethods/Notification.cs index 7abcca55e..14d23bdbc 100644 --- a/Duplicati/Server/WebServer/RESTMethods/Notification.cs +++ b/Duplicati/Server/WebServer/RESTMethods/Notification.cs @@ -30,7 +30,7 @@ namespace Duplicati.Server.WebServer.RESTMethods return;
}
- var el = Program.DataConnection.GetNotifications().Where(x => x.ID == id).FirstOrDefault();
+ var el = Program.DataConnection.GetNotifications().FirstOrDefault(x => x.ID == id);
if (el == null)
info.ReportClientError("No such notification", System.Net.HttpStatusCode.NotFound);
else
@@ -46,7 +46,7 @@ namespace Duplicati.Server.WebServer.RESTMethods return;
}
- var el = Program.DataConnection.GetNotifications().Where(x => x.ID == id).FirstOrDefault();
+ var el = Program.DataConnection.GetNotifications().FirstOrDefault(x => x.ID == id);
if (el == null)
info.ReportClientError("No such notification", System.Net.HttpStatusCode.NotFound);
else
diff --git a/Duplicati/Server/WebServer/RESTMethods/ServerSetting.cs b/Duplicati/Server/WebServer/RESTMethods/ServerSetting.cs index d0adad452..9454c15fa 100644 --- a/Duplicati/Server/WebServer/RESTMethods/ServerSetting.cs +++ b/Duplicati/Server/WebServer/RESTMethods/ServerSetting.cs @@ -69,7 +69,7 @@ namespace Duplicati.Server.WebServer.RESTMethods {
var settings = Program.DataConnection.Settings.ToList();
- var prop = settings.Where(x => string.Equals(key, x.Name, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
+ var prop = settings.FirstOrDefault(x => string.Equals(key, x.Name, StringComparison.OrdinalIgnoreCase));
if (prop == null)
settings.Add(prop = new Database.Setting() { Name = key, Value = info.Request.Form["data"].Value });
else
diff --git a/Duplicati/Server/WebServer/RESTMethods/Task.cs b/Duplicati/Server/WebServer/RESTMethods/Task.cs index e781cc7e8..730a30cf6 100644 --- a/Duplicati/Server/WebServer/RESTMethods/Task.cs +++ b/Duplicati/Server/WebServer/RESTMethods/Task.cs @@ -37,7 +37,7 @@ namespace Duplicati.Server.WebServer.RESTMethods return;
}
- if (tasks.Where(x => x.TaskID == taskid).FirstOrDefault() == null)
+ if (tasks.FirstOrDefault(x => x.TaskID == taskid) == null)
{
KeyValuePair<long, Exception>[] matches;
lock(Program.MainLock)
@@ -75,7 +75,7 @@ namespace Duplicati.Server.WebServer.RESTMethods if (task != null)
tasks.Insert(0, task);
- task = tasks.Where(x => x.TaskID == taskid).FirstOrDefault();
+ task = tasks.FirstOrDefault(x => x.TaskID == taskid);
if (task == null)
{
info.ReportClientError("No such task", System.Net.HttpStatusCode.NotFound);
diff --git a/Duplicati/Server/WebServer/RESTMethods/WebModule.cs b/Duplicati/Server/WebServer/RESTMethods/WebModule.cs index 5145653af..bf75c7ed1 100644 --- a/Duplicati/Server/WebServer/RESTMethods/WebModule.cs +++ b/Duplicati/Server/WebServer/RESTMethods/WebModule.cs @@ -23,7 +23,7 @@ namespace Duplicati.Server.WebServer.RESTMethods {
public void POST(string key, RequestInfo info)
{
- var m = Duplicati.Library.DynamicLoader.WebLoader.Modules.Where(x => x.Key.Equals(key, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
+ var m = Duplicati.Library.DynamicLoader.WebLoader.Modules.FirstOrDefault(x => x.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
if (m == null)
{
info.ReportClientError(string.Format("No such command {0}", key), System.Net.HttpStatusCode.NotFound);
|