From cca0dbf8f8be663ed0d8dea12f2e6ea110fceb4d Mon Sep 17 00:00:00 2001 From: Carl Johnsen Date: Wed, 5 Nov 2025 08:48:19 +0100 Subject: [PATCH] If the stream does not support streaming, it shouldn't be reset on failure (e.g. due to folder missing) --- Tools/RemoteSynchronization/LightWeightBackendManager.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Tools/RemoteSynchronization/LightWeightBackendManager.cs b/Tools/RemoteSynchronization/LightWeightBackendManager.cs index 931974a45..f5cc55cb8 100644 --- a/Tools/RemoteSynchronization/LightWeightBackendManager.cs +++ b/Tools/RemoteSynchronization/LightWeightBackendManager.cs @@ -271,9 +271,12 @@ namespace RemoteSynchronization Dispose(); // Dispose current backend and streaming backend. // Reset the stream, as it's in a potentially faulty state. - stream?.Seek(0, SeekOrigin.Begin); - if (resetStream) - stream?.SetLength(0); + if (stream != null && stream.CanSeek) + { + stream.Seek(0, SeekOrigin.Begin); + if (resetStream) + stream.SetLength(0); + } // Try to see if we can recover from the error. await TryRecoverFromException(ex, token).ConfigureAwait(false);