TGViewer
Telegram github commits and releases Telegram github commits and releases @tgappsupdates · 4.54K subscribers
Post #20624 59
UnigramDev/Unigram/ocr-extract-recovery • c3efb81 • 1 files, +64/-20
Recover from a damaged OCR model archive

Extracting Ocr_x64.zip crashed the app with an InvalidDataException,
"The archive entry was compressed using an unsupported compression
method". The message is misleading: Inflater maps zlib's Z_DATA_ERROR
onto that string, and the failure came from mid-entry writes in
DeflateStream.CopyToAsyncStream rather than from ZipArchiveEntry.Open,
so the deflate data was corrupt or truncated, not compressed with a
method the reader doesn't support. Why the local copy was damaged is
not established.

ExtractModelAsync had no try/catch and RecognizeText is async void, so
the failure reached the app unhandled. Catch it, delete the archive so
that the next attempt downloads a fresh copy, delete the partially
written model so that the readiness check in EnsureReadyAsync doesn't
accept it, and report the extraction as unavailable.

Separately, _extractLock.Release() sat outside any finally, so a throw
during extraction leaked the semaphore for the rest of the session:
every later extraction then returned early at Wait(0), leaving OCR
broken until restart.

Reported by crash telemetry on 12.9.1.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

#unigram
More from @tgappsupdates
  1. Oct 13, 2026telegramdesktop/tdesktop/dev • 096fc58 • 1 files, +1/-1 Fixed slowmode timer not showing i…
  2. Oct 13, 2026telegramdesktop/tdesktop/dev • 329b6d5 • 5 files, +52/-87 Added screen sharing button to n…
  3. Oct 12, 2026TGX-Android/Telegram-X/main • a7ce680 • 2 files, +14/-3 Fix answering call from background…
  4. Oct 12, 2026TGX-Android/Telegram-X/main • 8d2d958 • 2 files, +9/-2 Fix answering call from background…
  5. Oct 12, 2026TGX-Android/Telegram-X/main • f4bdd29 • 1 files, +10/-3 Fix passing `aapt2` arguments #tgx…
  6. Oct 12, 2026TGX-Android/Telegram-X/main • 4e2dd7e • 1 files, +1/-1 Reduce APK size #tgxandroid
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →