From f2d0d45b4320f6bf15770fe49c940cfdfd0db811 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 7 Mar 2024 14:50:48 +0100 Subject: [PATCH] Fixed backendtool not handling http options --- Duplicati/CommandLine/BackendTool/Program.cs | 62 +++++++++++++------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/Duplicati/CommandLine/BackendTool/Program.cs b/Duplicati/CommandLine/BackendTool/Program.cs index 7f646f82f..b367cddfc 100644 --- a/Duplicati/CommandLine/BackendTool/Program.cs +++ b/Duplicati/CommandLine/BackendTool/Program.cs @@ -1,28 +1,29 @@ -// Copyright (C) 2024, The Duplicati Team -// https://duplicati.com, hello@duplicati.com -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. +// Copyright (C) 2024, The Duplicati Team +// https://duplicati.com, hello@duplicati.com +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. using Duplicati.Library.Interface; using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Threading; namespace Duplicati.CommandLine.BackendTool @@ -92,6 +93,26 @@ namespace Duplicati.CommandLine.BackendTool return 200; } + + var modules = (from n in Library.DynamicLoader.GenericLoader.Modules + where n is Library.Interface.IConnectionModule + select n).ToArray(); + + var uri = new Library.Utility.Uri(args[1]); + var qp = uri.QueryParameters; + + var backendOpts = new Dictionary(); + foreach (var k in qp.Keys.Cast()) + backendOpts[k] = qp[k]; + + foreach (var k in backendOpts.Keys) { + options.Remove(k); + } + + foreach (var n in modules) { + n.Configure(options); + n.Configure(backendOpts); + } using(var backend = Library.DynamicLoader.BackendLoader.GetBackend(args[1], options)) { @@ -154,7 +175,6 @@ namespace Duplicati.CommandLine.BackendTool throw new Exception("Internal error"); } - } catch (Exception ex) {