Anchor runtime resolution at programs/server/npm so Office search indexing finds fflate, PDF indexing finds its worker and assets, and image conversion finds sharp. Parent resolution keeps source development working. Retain the file utility as a Docker runtime dependency for MIME detection.
Verify six focused regression suites and XLSX extraction plus PDF asset resolution in an isolated release container. Include negative archive and missing-dependency coverage.
Thanks to xet7.
substring check, an overly-permissive regex range and a no-op replace.
- models/lib/cardUrlAutolink.js and packages/markdown/src/
template-integration.js (kept in sync, per their own comments): the
card-title markdown-link escape only escaped ']', not the backslash
that precedes it, so a title ending in a raw backslash escaped the
']' this code inserts to close the label instead of the label
actually closing. Escape '\' before ']'.
- server/lib/documentGif.js: plainSearchText's control-character strip
used literal raw control bytes inside the regex character class
instead of \x escapes, so CodeQL flagged the range as unverifiable
(adjacent control bytes are visually indistinguishable, so a
boundary could silently shift). Rewritten with explicit \x escapes,
byte-for-byte equivalent to the original range.
- tests/notificationEmailUrlLink.test.cjs: built a dynamic RegExp by
hand-escaping only '/', leaving every other meta-character -
including backslash itself - unescaped. Added the same escapeRegExp
helper already used elsewhere in the codebase.
- tests/oauthLogoutUrl.test.cjs: asserted a returned URL did not
contain a hostname via `.includes()`, a substring check a
confusable/query-embedded hostname can fool either way. Compare the
parsed `new URL().hostname` instead.
- tests/boardCreationAdminOnly.test.cjs: `.replace(/ /g, ' ')` was a
no-op (replacing a space with itself); the actual intent was to
collapse runs of spaces, `.replace(/ +/g, ' ')`.
Every fix has a positive test proving the corrected behaviour and a
negative test reproducing the exact bypass/bug CodeQL flagged. None of
these cross a security boundary on their own (the markdown-link title
escaping is a rendering-correctness fix - DOMPurify still sanitizes
the final HTML regardless, per the existing code comments; the rest
are test-only assertion bugs), so no Admin Panel security-log entry
applies.
Thanks to GitHub CodeQL and xet7 !
Every PDF upload logged "Document search indexing failed: TypeError:
textDocument.destroy is not a function" and left that PDF's contents
unsearchable. pdfjs-dist's getDocument() returns a PDFDocumentLoadingTask;
destroy() lives THERE. Its .promise resolves to a PDFDocumentProxy, which
has no destroy() of its own - calling it on that object throws. The loading
task is now kept and destroyed instead.
Also silences "Ensure that the standardFontDataUrl API parameter is
provided" on every PDF: pdfjs-dist ships its own standard-font metrics and
CJK character maps as plain files in the installed package: point
standardFontDataUrl/cMapUrl at them via the same runtimeResolve trick
already used for the worker file, instead of falling back to an
approximation on every single PDF indexed.
Verified end-to-end against a real uploaded PDF, not just source patterns.
Thanks to xet7 !
The minimal server-rendered GIF-slideshow document preview (added this week
to cut dependency weight) kept failing with a bare 415 - its own
rasterization dependency chain (pdf-to-img -> pdfjs-dist's optional
@napi-rs/canvas) needed three separate fixes in a single day for a missing
package, a worker path resolved into the wrong bundle directory, and a stale
stored filename, and still left a text-only fallback as the best case for a
PDF.
Restore the previous full-featured viewer instead: office-open-xml-viewer
(MIT, canvas-based, zero runtime dependencies) renders DOCX/XLSX/PPTX
client-side, and PDF goes back to the browser's own native <embed> viewer -
simpler, zero extra dependencies, and gets the browser's own zoom/search/
print for free.
The server-side full-text search this week's change introduced is kept:
server/lib/documentGif.js now does nothing but extract plain text for the
search index (indexDocumentText, triggered in the background from
Attachments.onAfterUpload) - no rendering, no HTML, no page images - so
pdf-to-img and @napi-rs/canvas are dropped entirely (nothing rasterizes a
PDF page server-side any more) while pdfjs-dist stays, now as a direct
dependency, for its text-only extraction. Searching attachment contents from
the card search box keeps working exactly as before.
Thanks to xet7 !
Opening the PDF slideshow viewer on an attached PDF still failed with a 415
after the previous #6685 fix, now with the real error visible:
"Setting up fake worker failed: Cannot find module
'.../_build/main-dev/pdf.worker.mjs'". pdfjs-dist's Node fake-worker
fallback locates pdf.worker.mjs relative to import.meta.url of the module
that imported it; under the bundled server (_build/main-dev,
_build/main-prod) that URL points into the bundle output, not into
node_modules, so the fallback looked for the worker beside the bundled
server.cjs and never found it - every PDF preview failed, image and text
alike, not only the rasterized-image path the earlier fix addressed.
Point GlobalWorkerOptions.workerSrc at the real on-disk file via Node's own
module resolution (the same runtimeRequire trick already used for fflate)
so pdfjs never falls back to guessing. pdf-to-img imports the same single
pdfjs-dist instance, so this also fixes its internal rasterization.
Thanks to rmb82 and xet7 !
pdf-to-img rasterizes PDF pages through pdfjs-dist's optionalDependency
@napi-rs/canvas. A Docker/Snap build that skips optional dependencies, or
lacks a prebuilt binary for its target architecture, then throws on the
very first PDF preview - "Cannot load @napi-rs/canvas", "Cannot polyfill
DOMMatrix" - which the generic catch in server/routes/universalFileServer.js
turned into a bare 415 with the real error never logged.
@napi-rs/canvas is now a direct dependency so it installs the same way
every other required package does. Rasterization is also no longer
all-or-nothing: pdfjs-dist's text extraction does not need canvas, so when
rasterizing still fails for any reason the PDF preview now degrades to
text-only pages (dropped images, kept text) instead of failing outright -
the same graceful degradation the minimal viewer already applies to an
unreadable embedded image in a DOCX/PPTX/XLSX. The three document-preview
routes now log the caught error before returning 415.
Thanks to rmb82 and xet7 !
Fixes#6685,
Remove the progressive HTML4/Legacy Omi middleware, cookieless sessions, page controllers, assets, parity refactors, design documents and associated tests. Restore the standard Meteor interface and operations from before the HTML4 work began.
Preserve intervening translations, backup screenshots, session upgrades, cryptographic test identifiers, local image storage, document previews and lazy browser loading. Extract the GIF utilities still required by image features into imageGif.
Validate the Node suites and add standard-interface and GIF regressions. Two existing failures remain in docsLinksResolve and ruleDetailsLocalization; browser regressions are registered but require a running server.
Thanks to xet7 !