FB2: don't throw when image has no xlink:href

Fixes #35
This commit is contained in:
John Factotum
2024-09-25 23:15:02 +08:00
parent dcd4ff403e
commit e94b85ce09
+2
View File
@@ -71,7 +71,9 @@ const BODY = {
const getImageSrc = el => {
const href = el.getAttributeNS(NS.XLINK, 'href')
if (!href) return 'data:,'
const [, id] = href.split('#')
if (!id) return href
const bin = el.getRootNode().getElementById(id)
return bin
? `data:${bin.getAttribute('content-type')};base64,${bin.textContent}`