From 9a43b53ebe200e87eeb92796a86351022f18861f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 8 Dec 2017 00:04:00 -0500 Subject: [PATCH] Show file path instead of "(null)" when installing style via file open And fix deprecation warning from passing an nsIFile (Also updates the Zotero.Styles.install() documentation to note that the first parameter's `file` property can be a string path.) --- chrome/content/zotero/xpcom/style.js | 9 +++++---- components/zotero-service.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js index 3293d8a9ec..c71189758c 100644 --- a/chrome/content/zotero/xpcom/style.js +++ b/chrome/content/zotero/xpcom/style.js @@ -269,10 +269,11 @@ Zotero.Styles = new function() { /** * Installs a style file, getting the contents of an nsIFile and showing appropriate * error messages - * @param {Object} style An object with one of the following properties - * - file: An nsIFile representing a style on disk - * - url: A url of the location of the style (local or remote) - * - string: A string containing the style data + * @param {Object} style - An object with one of the following properties + * - file: An nsIFile or string path representing a style on disk + * - path: A string path + * - url: A url of the location of the style (local or remote) + * - string: A string containing the style data * @param {String} origin The origin of the style, either a filename or URL, to be * displayed in dialogs referencing the style * @param {Boolean} [silent=false] Skip prompts diff --git a/components/zotero-service.js b/components/zotero-service.js index a490f9ce3e..4a3af985a7 100644 --- a/components/zotero-service.js +++ b/components/zotero-service.js @@ -623,7 +623,7 @@ ZoteroCommandLineHandler.prototype = { if(file.leafName.substr(-4).toLowerCase() === ".csl" || file.leafName.substr(-8).toLowerCase() === ".csl.txt") { // Install CSL file - Zotero.Styles.install(file); + Zotero.Styles.install({ file: file.path }, file.path); } else { // Ask before importing var checkState = {