diff --git a/.github/dev.yml b/.github/dev.yml index 924fdae..eb3a62f 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.5-dev.$(Rev:r) +name: 3.6.6-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index 2a56bdd..84d0df4 100644 --- a/FAQ.md +++ b/FAQ.md @@ -235,7 +235,7 @@ In particular, it will detect and handle automatically and properly the various * 2FA password required (your Config needs to provide "password") * Email registration procedure required (your Config needs to provide "email", "email_verification_code") * Account registration/sign-up required (your Config needs to provide "first_name", "last_name") -* Request to resend the verification code through alternate ways like SMS (if your Config answer an empty "verification_code" initially) +* Request to resend the verification code through alternate ways (if your Config answer an empty "verification_code" initially) * Transient failures, slowness to respond, wrong code/password, checks for encryption key safety, etc.. Contrary to TLSharp, WTelegramClient supports MTProto v2.0 (more secured), transport obfuscation, protocol security checks, MTProto [Proxy](EXAMPLES.md#proxy), real-time updates, multiple DC connections, API documentation in Intellisense... diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 4bed1ae..c0ac2f1 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -317,7 +317,7 @@ namespace WTelegram var client = dc_id == 0 ? this : await GetClientForDC(dc_id, true); using var writeSem = new SemaphoreSlim(1); bool canSeek = outputStream.CanSeek; - long streamStartPos = outputStream.Position; + long streamStartPos = canSeek ? outputStream.Position : 0; long fileOffset = 0, maxOffsetSeen = 0; long transmitted = 0; var tasks = new Dictionary(); @@ -373,7 +373,7 @@ namespace WTelegram await writeSem.WaitAsync(); try { - if (streamStartPos + offset != outputStream.Position) // if we're about to write out of order + if (canSeek && streamStartPos + offset != outputStream.Position) // if we're about to write out of order { await outputStream.FlushAsync(); // async flush, otherwise Seek would do a sync flush outputStream.Seek(streamStartPos + offset, SeekOrigin.Begin);