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:
authorSerge <8523760+sergethedev17@users.noreply.github.com>2021-05-31 19:51:42 +0300
committerSerge <8523760+sergethedev17@users.noreply.github.com>2021-05-31 19:51:42 +0300
commit955dbebc03cf9b5d9ae0d6b2af1f8c277db0649f (patch)
tree86c5bfeb6c58a974ebf2c66d1af287224b96671c /Duplicati/Library/Backend
parented86cca3e468f4a3e33c3d0faec1d22cb194bda2 (diff)
Check contents of written test file
Before performing test write, reset stream Position to 0, otherwise test performs zero-byte write. When performing test read, verify that file was written correctly.
Diffstat (limited to 'Duplicati/Library/Backend')
-rw-r--r--Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
index 0e027df83..28f9c0403 100644
--- a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
+++ b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
@@ -451,6 +451,7 @@ namespace Duplicati.Library.Backend.AlternativeFTP
var stream = new MemoryStream();
var writer = new StreamWriter(stream) { AutoFlush = true };
writer.Write(str);
+ stream.Position = 0;
return stream;
}
@@ -488,11 +489,14 @@ namespace Duplicati.Library.Backend.AlternativeFTP
}
// Test read permissions
- using (var stream = new MemoryStream())
+ using (var testStream = new MemoryStream())
{
try
{
- Get(TEST_FILE_NAME, stream);
+ Get(TEST_FILE_NAME, testStream);
+ var readValue = System.Text.Encoding.Default.GetString(testStream.ToArray());
+ if (readValue != TEST_FILE_CONTENT)
+ throw new Exception("Test file corrupted.");
}
catch (Exception e)
{