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-06-02 12:35:40 +0300
committerSerge <8523760+sergethedev17@users.noreply.github.com>2021-06-02 12:35:40 +0300
commit5404fed63458958d1983143d4cfdd00f3b0c8ae1 (patch)
treecea39d8b82a3a7d089dd43a9a4a2c4220349f68f /Duplicati/Library
parent955dbebc03cf9b5d9ae0d6b2af1f8c277db0649f (diff)
Do not use StreamWriter
Diffstat (limited to 'Duplicati/Library')
-rw-r--r--Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs13
1 files changed, 2 insertions, 11 deletions
diff --git a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
index 28f9c0403..23d3a3f6c 100644
--- a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
+++ b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
@@ -446,15 +446,6 @@ namespace Duplicati.Library.Backend.AlternativeFTP
get { return new string[] { new Uri(_url).Host }; }
}
- private static Stream StringToStream(string str)
- {
- var stream = new MemoryStream();
- var writer = new StreamWriter(stream) { AutoFlush = true };
- writer.Write(str);
- stream.Position = 0;
- return stream;
- }
-
/// <summary>
/// Test FTP access permissions.
/// </summary>
@@ -476,7 +467,7 @@ namespace Duplicati.Library.Backend.AlternativeFTP
}
// Test write permissions
- using (var testStream = StringToStream(TEST_FILE_CONTENT))
+ using (var testStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(TEST_FILE_CONTENT)))
{
try
{
@@ -494,7 +485,7 @@ namespace Duplicati.Library.Backend.AlternativeFTP
try
{
Get(TEST_FILE_NAME, testStream);
- var readValue = System.Text.Encoding.Default.GetString(testStream.ToArray());
+ var readValue = System.Text.Encoding.UTF8.GetString(testStream.ToArray());
if (readValue != TEST_FILE_CONTENT)
throw new Exception("Test file corrupted.");
}