commit 1c92fe3268148523853de8239d09891437662c3c parent 67f358df4b9342e8606d210ba66374305f2dbdae Author: Dan Stillman <dstillman@zotero.org> Date: Sat, 16 Apr 2016 16:50:27 -0400 Fix getFile() deprecation warning for zotero://attachment URLs Diffstat:
| M | components/zotero-protocol-handler.js | | | 12 | ++++++------ |
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js @@ -753,14 +753,14 @@ function ZoteroProtocolHandler() { if (!item) { return self._errorChannel("Item not found"); } - var file = item.getFile(); - if (!file) { + var path = yield item.getFilePathAsync(); + if (!path) { return self._errorChannel("File not found"); } if (fileName) { - file = file.parent; - file.append(fileName); - if (!file.exists()) { + Components.utils.import("resource://gre/modules/osfile.jsm"); + path = OS.Path.join(OS.Path.dirname(path), fileName) + if (!(yield OS.File.exists(path))) { return self._errorChannel("File not found"); } } @@ -771,7 +771,7 @@ function ZoteroProtocolHandler() { //otherwise they try to link to files on the file:// protocol, which is not allowed this.originalURI = uri; - return file; + return Zotero.File.pathToFile(path); } catch (e) { Zotero.debug(e);