Fix passing file: URI to Zotero.File.getContentsAsync()
This commit is contained in:
parent
f44264cd4d
commit
f2440eb826
2 changed files with 8 additions and 1 deletions
|
@ -273,7 +273,7 @@ Zotero.File = new function(){
|
|||
if (source instanceof Components.interfaces.nsIFile) {
|
||||
source = source.path;
|
||||
}
|
||||
else if (source.startsWith('^file:')) {
|
||||
else if (source.startsWith('file:')) {
|
||||
source = OS.Path.fromFileURI(source);
|
||||
}
|
||||
var options = {
|
||||
|
|
|
@ -48,6 +48,13 @@ describe("Zotero.File", function () {
|
|||
assert.lengthOf(contents, 6);
|
||||
assert.equal(contents, "Zotero");
|
||||
});
|
||||
|
||||
it("should get a file from a file: URI", function* () {
|
||||
var contents = yield Zotero.File.getContentsAsync(
|
||||
OS.Path.toFileURI(OS.Path.join(getTestDataDirectory().path, "test.txt"))
|
||||
);
|
||||
assert.isTrue(contents.startsWith('Zotero'));
|
||||
});
|
||||
})
|
||||
|
||||
describe("#getBinaryContentsAsync()", function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue