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:
authorDoug Krahmer <doug.git@remhark.com>2022-03-17 01:04:34 +0300
committerDoug Krahmer <doug.git@remhark.com>2022-03-18 21:14:50 +0300
commit9d029a09a2870a89cb62b0073f24a65fcb35052c (patch)
tree1de8bf31cd8e175bbc8620813d1fd9ada67b2b7b /Duplicati
parentd1f10ba9a1082dcb5a1d9c001752f888d80b63bd (diff)
Minor IDrive backend enhancements
Diffstat (limited to 'Duplicati')
-rw-r--r--Duplicati/Library/Backend/IDrive/IDriveApiClient.cs9
-rw-r--r--Duplicati/Library/Backend/IDrive/IDriveBackend.cs12
2 files changed, 9 insertions, 12 deletions
diff --git a/Duplicati/Library/Backend/IDrive/IDriveApiClient.cs b/Duplicati/Library/Backend/IDrive/IDriveApiClient.cs
index a94ea3f1e..9f9c6910d 100644
--- a/Duplicati/Library/Backend/IDrive/IDriveApiClient.cs
+++ b/Duplicati/Library/Backend/IDrive/IDriveApiClient.cs
@@ -115,9 +115,10 @@ namespace Duplicati.Library.Backend.IDrive
throw new AuthenticationException($"Failed 'getServerAddress' request. Empty hostname. Tree XML: {responseNode.OuterXml}");
}
- public async Task<List<FileEntry>> GetNodeListAsync(string directoryPath, string searchCriteria = "*")
+ public async Task<List<FileEntry>> GetFileEntryListAsync(string directoryPath, string searchCriteria = null)
{
- const string methodName = "searchFiles";
+ string methodName = string.IsNullOrEmpty(searchCriteria) ? "browseFolder" : "searchFiles";
+ // NOTE: The IDrive "searchFiles" API method has a bug that returns the name of the directory being listed as one of the items when searching for "*"
string url = GetSyncServiceUrl(methodName);
var list = new List<FileEntry>();
@@ -232,8 +233,8 @@ namespace Duplicati.Library.Backend.IDrive
}
}
- var nodeList = await GetNodeListAsync(directoryPath, filename);
- return nodeList.FirstOrDefault();
+ var fileEntryList = await GetFileEntryListAsync(directoryPath, filename);
+ return fileEntryList.FirstOrDefault();
}
public async Task DownloadAsync(string filePath, Stream stream)
diff --git a/Duplicati/Library/Backend/IDrive/IDriveBackend.cs b/Duplicati/Library/Backend/IDrive/IDriveBackend.cs
index e3c5383da..0781ee77b 100644
--- a/Duplicati/Library/Backend/IDrive/IDriveBackend.cs
+++ b/Duplicati/Library/Backend/IDrive/IDriveBackend.cs
@@ -16,7 +16,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using Duplicati.Library.Common.IO;
using Duplicati.Library.Interface;
-using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -105,7 +104,7 @@ namespace Duplicati.Library.Backend.IDrive
private async Task ResetFileCacheAsync()
{
- FileCache = (await Client.GetNodeListAsync(_baseDirectoryPath))
+ FileCache = (await Client.GetFileEntryListAsync(_baseDirectoryPath))
.Where(x => !x.IsFolder)
.ToDictionary(x => x.Name, x => x);
}
@@ -136,11 +135,8 @@ namespace Duplicati.Library.Backend.IDrive
{
try
{
- if (FileCache.ContainsKey(filename))
- Delete(filename);
-
- var fileNode = await Client.UploadAsync(stream, filename, _baseDirectoryPath, cancelToken);
- FileCache[filename] = fileNode;
+ var fileEntry = await Client.UploadAsync(stream, filename, _baseDirectoryPath, cancelToken);
+ FileCache[filename] = fileEntry;
}
catch
{
@@ -161,7 +157,7 @@ namespace Duplicati.Library.Backend.IDrive
throw new FileMissingException();
}
- Client.DeleteAsync(_baseDirectoryPath + filename, false).Wait();
+ Client.DeleteAsync(Path.Combine(_baseDirectoryPath, filename), false).Wait();
FileCache.Remove(filename);
}