commit 9a43b53ebe200e87eeb92796a86351022f18861f
parent 045f1fbb7e86eb6ee1e9790892687a18ab8f868a
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 8 Dec 2017 00:04:00 -0500
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.)
Diffstat:
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git 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
@@ -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 = {