Fix for the streaming error on BackendTester interaction

This issue does not affect the pCloud backend per se and its functioning as expected.

The issue is related to a symptom the BackendTester revealed as discussed here:

https://github.com/duplicati/duplicati/pull/5709

It turns out the backends should assume the caller has set the input stream at the correct position and take it from there.

Therefore the fix is simply to remove the .Position = 0; which was well intended as a way to make sure the stream was at the beginning, but  thats not the pattern to follow when integrating backends.

A future blog post/tutorial on new backend integrations will mention these premises.
This commit is contained in:
Marcelo C.
2024-11-27 19:34:18 +01:00
parent 302e2dd858
commit 2eab4611de
@@ -250,7 +250,6 @@ public class pCloudBackend : IStreamingBackend
using var requestResources =
CreateRequest($"/uploadfile?folderid={_CachedFolderID}&filename={encodedPath}&nopartial=1",
HttpMethod.Post);
input.Position = 0;
requestResources.RequestMessage.Content = new StreamContent(input);
requestResources.RequestMessage.Content.Headers.ContentLength = input.Length;
requestResources.RequestMessage.Content.Headers.ContentType =