From 059d13401aba587315da4a6d3f6bf8f4557fb1b5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Dec 2026 17:04:25 +0000 Subject: [PATCH] Decompress PDF images in JavaScript pdf.js decompresses PDF images with the runtime's native DecompressionStream when it exists. Removing that global selects its JavaScript decompressor, which suits a server that opens PDFs from any URL. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01CtESSS5aXn7L6Q6NqAp2TE --- src/modules/example-apps/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/example-apps/index.ts b/src/modules/example-apps/index.ts index 519e3d8..0083c86 100644 --- a/src/modules/example-apps/index.ts +++ b/src/modules/example-apps/index.ts @@ -38,6 +38,11 @@ import { createServer as createWikiExplorerServer } from '@modelcontextprotocol/ import { LAZY_AUTH_SLUG } from './lazy-auth.js'; +// pdf.js inflates images with the native DecompressionStream, and falls back to +// its own JavaScript inflate when that global is missing. Remove it so PDFs +// from arbitrary URLs are only decompressed in JavaScript. +Reflect.deleteProperty(globalThis, 'DecompressionStream'); + declare module "express-serve-static-core" { interface Request { auth?: AuthInfo;