Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ export async function inlineResources(element: Element): Promise<void> {
...[...element.children].map(inlineResources),
(async () => {
if (isSVGImageElement(element)) {
const blob = await withTimeout(10000, `Timeout fetching ${element.href.baseVal}`, () =>
fetchResource(element.href.baseVal)
const elementHref = element.getAttribute('href') || element.getAttribute('xlink:href');
assert(elementHref, "Expected <image> element to have an href or xlink:href attribute");

const blob = await withTimeout(10000, `Timeout fetching ${elementHref}`, () =>
fetchResource(elementHref)
)
if (blob.type === 'image/svg+xml') {
// If the image is an SVG, inline it into the output SVG.
Expand Down