Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Skovhede <kenneth@hexad.dk>2021-08-11 11:41:34 +0300
committerGitHub <noreply@github.com>2021-08-11 11:41:34 +0300
commite81595a611827f612a7771d7179f871708cbe8df (patch)
treea51f6cf740892cbe86419510c9cb42b41016e978 /Duplicati/Library/Backend
parent8d78d8a64a67221d43fce1c986725ba4e66f2f1a (diff)
parent356f270b128a826d7f1f0e0b764b6890be99f9e6 (diff)
Merge pull request #4588 from warwickmm/fix_ftp_path_handling
Fix Alternative FTP handling of paths with escaped characters
Diffstat (limited to 'Duplicati/Library/Backend')
-rw-r--r--Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs12
1 files changed, 9 insertions, 3 deletions
diff --git a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
index 3c99e48ac..0501760ea 100644
--- a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
+++ b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
@@ -221,7 +221,7 @@ namespace Duplicati.Library.Backend.AlternativeFTP
// Get the remote path
var url = new Uri(this._url);
- remotePath = "/" + (url.AbsolutePath.EndsWith("/", StringComparison.Ordinal) ? url.AbsolutePath.Substring(0, url.AbsolutePath.Length - 1) : url.AbsolutePath);
+ remotePath = "/" + this.GetUnescapedAbsolutePath(url);
if (!string.IsNullOrEmpty(filename))
{
@@ -513,7 +513,7 @@ namespace Duplicati.Library.Backend.AlternativeFTP
var url = new Uri(_url);
// Get the remote path
- var remotePath = url.AbsolutePath.EndsWith("/", StringComparison.Ordinal) ? url.AbsolutePath.Substring(0, url.AbsolutePath.Length - 1) : url.AbsolutePath;
+ var remotePath = this.GetUnescapedAbsolutePath(url);
// Try to create the directory
client.CreateDirectory(remotePath, true);
@@ -555,12 +555,18 @@ namespace Duplicati.Library.Backend.AlternativeFTP
// Change working directory to the remote path
// Do this every time to prevent issues when FtpClient silently reconnects after failure.
- var remotePath = uri.AbsolutePath.EndsWith("/", StringComparison.Ordinal) ? uri.AbsolutePath.Substring(0, uri.AbsolutePath.Length - 1) : uri.AbsolutePath;
+ var remotePath = this.GetUnescapedAbsolutePath(uri);
this.Client.SetWorkingDirectory(remotePath);
return this.Client;
}
+ private string GetUnescapedAbsolutePath(Uri uri)
+ {
+ string absolutePath = Uri.UnescapeDataString(uri.AbsolutePath);
+ return absolutePath.EndsWith("/", StringComparison.Ordinal) ? absolutePath.Substring(0, absolutePath.Length - 1) : absolutePath;
+ }
+
private void HandleValidateCertificate(FtpClient control, FtpSslValidationEventArgs e)
{
if (e.PolicyErrors == SslPolicyErrors.None || _accepAllCertificates)