From 2eab4611decbbb16092fdfb986ce289b8caacf4f Mon Sep 17 00:00:00 2001 From: "Marcelo C." Date: Wed, 27 Nov 2024 19:34:18 +0100 Subject: [PATCH] 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. --- Duplicati/Library/Backend/pCloud/pCloudBackend.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Duplicati/Library/Backend/pCloud/pCloudBackend.cs b/Duplicati/Library/Backend/pCloud/pCloudBackend.cs index d9fe1f10b..454c7046d 100644 --- a/Duplicati/Library/Backend/pCloud/pCloudBackend.cs +++ b/Duplicati/Library/Backend/pCloud/pCloudBackend.cs @@ -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 =