translators icon indicating copy to clipboard operation
translators copied to clipboard

Error in Embedded Metadata translator when the page has no description

Open Lucidiot opened this issue 2 years ago • 0 comments

Running the Embedded Metadata translator on https://daverupert.com/2022/10/the-story-of-this-empty-box/ results in this error:

Error: trimInternal: argument must be a string
  at Zotero.Utilities.Translate.trimInternal (/app/modules/zotero/chrome/content/zotero/xpcom/utilities.js:281:10)
  at Function.trimInternal (/app/src/translation/sandboxManager.js:96:17)
  at addLowQualityMetadata (eval at <anonymous> (/app/src/translation/sandboxManager.js:70:4), <anonymous>:697:29)
  at completeItem (eval at <anonymous> (/app/src/translation/sandboxManager.js:70:4), <anonymous>:216:2)
  at eval (eval at <anonymous> (/app/src/translation/sandboxManager.js:70:4), <anonymous>:343:4)
  at /app/modules/zotero/chrome/content/zotero/xpcom/translation/translate.js:384:8
  at Zotero.Translate.Import._runHandler (/app/modules/zotero/chrome/content/zotero/xpcom/translation/translate.js:1128:32)
  at run (/app/modules/zotero/chrome/content/zotero/xpcom/translation/translate.js:188:23)
  at /app/modules/zotero/chrome/content/zotero/xpcom/translation/translate.js:250:6
  at new Promise (<anonymous>)

When there was no metadata tag found with a namespace that the RDF translator supports, the Embedded Metadata translator tries to look for a <meta name="description"> with no namespace at all. If no metadata is found then the translator just crashes instead of continuing with trying to find other metadata. It sounds like a type check might be missing on this line?

Lucidiot avatar Nov 19 '22 09:11 Lucidiot