Fix getFile() deprecation warning for zotero://attachment URLs
This commit is contained in:
parent
67f358df4b
commit
1c92fe3268
1 changed files with 6 additions and 6 deletions
|
@ -753,14 +753,14 @@ function ZoteroProtocolHandler() {
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return self._errorChannel("Item not found");
|
return self._errorChannel("Item not found");
|
||||||
}
|
}
|
||||||
var file = item.getFile();
|
var path = yield item.getFilePathAsync();
|
||||||
if (!file) {
|
if (!path) {
|
||||||
return self._errorChannel("File not found");
|
return self._errorChannel("File not found");
|
||||||
}
|
}
|
||||||
if (fileName) {
|
if (fileName) {
|
||||||
file = file.parent;
|
Components.utils.import("resource://gre/modules/osfile.jsm");
|
||||||
file.append(fileName);
|
path = OS.Path.join(OS.Path.dirname(path), fileName)
|
||||||
if (!file.exists()) {
|
if (!(yield OS.File.exists(path))) {
|
||||||
return self._errorChannel("File not found");
|
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
|
//otherwise they try to link to files on the file:// protocol, which is not allowed
|
||||||
this.originalURI = uri;
|
this.originalURI = uri;
|
||||||
|
|
||||||
return file;
|
return Zotero.File.pathToFile(path);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Zotero.debug(e);
|
Zotero.debug(e);
|
||||||
|
|
Loading…
Add table
Reference in a new issue