You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): omit SVG metadata from EPUB attachment text - #44943
When a user attaches an EPUB whose inline <svg> or standalone .svg spine item contains a <metadata> block (such as RDF metadata from Matplotlib, Inkscape, or Illustrator), the server leaks generator strings, timestamps, and MIME types into the extracted sidecar instead of omitting them.
Change
In apps/server/src/provider/documentTextWorker.ts, xml() drops <metadata> in the SVG namespace (http://www.w3.org/2000/svg) when extension === ".epub". This covers inline <svg> (default or prefixed) and standalone .svg spine items while leaving OPF package <metadata>, foreign-namespace <metadata>, and SVG <title>/<desc> intact. Added one EPUB SVG row to apps/server/src/provider/userInputAttachments.test.ts.
Scope
Small bug fix (4 changed non-test lines, 1 file) for non-rendered SVG <metadata> leaking into EPUB attachment text; needs no separate issue.
Verification
Setup: Linux (Node v26.13.1), sandboxed server (T3CODE_DEV_SEED=0, --base-dir, TZ=UTC, synthetic project, devReplay), isolated home per commit.
Steps: Upload chart.epub (Matplotlib v3.11.2 SVG inline in ch1.xhtml and standalone chart.svg) via /api/attachments/upload/... → send on devReplay thread → wait → read .epub.txt.
Reviewing files that changed from the base of the PR and between c5a31ff and 66f4218.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The EPUB XML extractor now removes SVG <metadata> elements. The added fixture checks visible SVG content in embedded and standalone SVGs, and verifies that metadata from a foreign namespace remains.
Changes: EPUB SVG metadata filtering
Layer / File(s)
Summary
SVG metadata filtering and coverage apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts
The extractor recognizes the SVG namespace and removes SVG <metadata> elements from EPUB content. The fixture checks visible SVG titles, descriptions, and text, while excluding SVG metadata and retaining a foreign-namespace metadata element.
This change stops hidden SVG metadata from appearing in extracted EPUB attachment text, while visible SVG text is kept. The impact is limited to EPUB text extraction. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(server): omit SVG metadata from EPUB attachment text" names the main change: the server now drops SVG-namespace metadata blocks when extracting EPUB attachment text. It follows the conv…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections, and each section has substantive content. The Problem and Change sections state the bug and the fix clea…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(server): omit SVG metadata from EPUB attachment text" names the main change: the server now drops SVG-namespace metadata blocks when extracting EPUB attachment text. It follows the conventional commit format and matches the raw summary, the test additions, and the PR objectives.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections, and each section has substantive content. The Problem and Change sections state the bug and the fix clearly. Scope explains why the PR is a small bug fix and needs no separate issue. Verification gives a before/after reproduction, fail-first and passing test output, and the checks run, and it lists what was not tested. The description does not link a maintainer request, which is optional. It also does not name the model and harness that did the work, which the template asks for when an agent was used. The author lists 'Generated with Gemini 4 Neon' in the footer, which may not match the required harness line. This is a minor gap and does not block merge.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Uploaded the same synthetic EPUB containing inline and standalone SVG charts, sent 'Summarize the attached report.' with Replay (dev) Showcase, then opened an unchanged copy of the server-generated attachment sidecar in the app file viewer. Both runs used fresh isolated state, Chromium, light theme, and a 1280×800 viewport.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a user attaches an EPUB whose inline
<svg>or standalone.svgspine item contains a<metadata>block (such as RDF metadata from Matplotlib, Inkscape, or Illustrator), the server leaks generator strings, timestamps, and MIME types into the extracted sidecar instead of omitting them.Change
In
apps/server/src/provider/documentTextWorker.ts,xml()drops<metadata>in the SVG namespace (http://www.w3.org/2000/svg) whenextension === ".epub". This covers inline<svg>(default or prefixed) and standalone.svgspine items while leaving OPF package<metadata>, foreign-namespace<metadata>, and SVG<title>/<desc>intact. Added one EPUB SVG row toapps/server/src/provider/userInputAttachments.test.ts.Scope
Small bug fix (4 changed non-test lines, 1 file) for non-rendered SVG
<metadata>leaking into EPUB attachment text; needs no separate issue.Verification
Setup: Linux (Node
v26.13.1), sandboxed server (T3CODE_DEV_SEED=0,--base-dir,TZ=UTC, synthetic project,devReplay), isolated home per commit.Steps: Upload
chart.epub(Matplotlib v3.11.2 SVG inline inch1.xhtmland standalonechart.svg) via/api/attachments/upload/...→ send ondevReplaythread → wait → read.epub.txt.Before (
f5ea2d3586d4):After (
c5a31fffdb63):Links:
apps/server/src/provider/userInputAttachments.test.ts.Not shown:
<metadata><rdf:RDF>SVG).<defs>/<symbol>(kept intact because<use>is not expanded, so dropping them could lose visible text).devReplayused) and repo-wide test/typecheck suites (CI runs them).Focused test output and local checks
Base commit:
f5ea2d3586d4(20/20 check-runs green, commit statussuccess).Fail-first on
f5ea2d3586d4(vp env exec --node 26.13.1 -- vp test run apps/server/src/provider/userInputAttachments.test.ts):Passing on
c5a31fffdb63(Nodev26.13.1):vp test run apps/server/src/provider/userInputAttachments.test.ts: 69 passed (69).vp run check:changed f5ea2d3586d4d1be3670e22eba4163ef86fd99b7: exit 0 (format, lint 0 warnings, knip, graphql, typecheck 3 packages, 3 test files / 73 passed).Generated with Gemini 4 Neon in T3 Code Nightly