-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
How are you running AnythingLLM?
Docker (local)
What happened?
Getting this error while uploading an EPUB:
[backend] info: [EncryptionManager] Loaded existing key & salt for encrypting arbitrary data.
C:\Program Files\AnythingLLM\resources\backend\node_modules\xml2js\lib\parser.js:344
throw err;
^
TypeError: ((branch[i].navLabel && branch[i].navLabel.text) || branch[i].navLabel || "").trim is not a function
at EPub.walkNavMap (C:\Program Files\AnythingLLM\resources\backend\node_modules\epub2\lib\epub.js:539:105)
at Parser. (C:\Program Files\AnythingLLM\resources\backend\node_modules\epub2\lib\epub.js:492:37)
at Parser.emit (node:events:519:28)
at SAXParser.onclosetag (C:\Program Files\AnythingLLM\resources\backend\node_modules\xml2js\lib\parser.js:276:26)
at emit (C:\Program Files\AnythingLLM\resources\backend\node_modules\sax\lib\sax.js:631:35)
at emitNode (C:\Program Files\AnythingLLM\resources\backend\node_modules\sax\lib\sax.js:636:5)
at closeTag (C:\Program Files\AnythingLLM\resources\backend\node_modules\sax\lib\sax.js:896:7)
at SAXParser.write (C:\Program Files\AnythingLLM\resources\backend\node_modules\sax\lib\sax.js:1460:13)
at exports.Parser.Parser.parseString (C:\Program Files\AnythingLLM\resources\backend\node_modules\xml2js\lib\parser.js:337:31)
at Parser.parseString (C:\Program Files\AnythingLLM\resources\backend\node_modules\xml2js\lib\parser.js:5:59)
at C:\Program Files\AnythingLLM\resources\backend\node_modules\epub2\lib\epub.js:500:23
at C:\Program Files\AnythingLLM\resources\backend\node_modules\epub2\zipfile.js:29:21
at C:\Program Files\AnythingLLM\resources\backend\node_modules\adm-zip\zipEntry.js:132:33
at InflateRaw. (C:\Program Files\AnythingLLM\resources\backend\node_modules\adm-zip\methods\inflater.js:29:29)
at InflateRaw.emit (node:events:519:28)
at endReadableNT (node:internal/streams/readable:1696:12)
Node.js v20.18.0
modified AnythingLLM\resources\backend\node_modules\epub2\lib\epub.js
at this line
title = (branch[i].navLabel && branch[i].navLabel.text || branch[i].navLabel || "").trim();
like this
title = (String((branch[i].navLabel && branch[i].navLabel.text) || branch[i].navLabel || "")).trim();
restarted and it works
Are there known steps to reproduce?
Try different epubs from public free re source a many will fail