diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index d03885d1d1..2e54259ff3 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -273,8 +273,13 @@ Zotero.File = new function(){ if (source instanceof Components.interfaces.nsIFile) { source = source.path; } - else if (source.startsWith('file:')) { - source = OS.Path.fromFileURI(source); + else if (typeof source == 'string') { + if (source.startsWith('file:')) { + source = OS.Path.fromFileURI(source); + } + } + else { + throw new Error(`Unsupported type '${typeof source}' for source`); } var options = { encoding: charset ? charset : "utf-8"