Fix regression: download() fails for non-http URLs (#2497)
This fixes compatiblity with some addons that use Zotero.File.download to extract files from their XPI bundle.
This commit is contained in:
parent
776769f480
commit
56321a7a6d
3 changed files with 12 additions and 2 deletions
|
@ -525,5 +525,13 @@ describe("Zotero.File", function () {
|
|||
assert.equal(fileSize, 1024 * 1024 * sizeInMB);
|
||||
}
|
||||
});
|
||||
|
||||
it("should extract a file from xpi", async function () {
|
||||
const url = `jar:file://${getTestDataDirectory().path}/fake.xpi!/test.txt`;
|
||||
const path = OS.Path.join(Zotero.getTempDirectory().path, 'xpi-extracted.txt');
|
||||
await Zotero.File.download(url, path);
|
||||
const contents = await Zotero.File.getContentsAsync(path);
|
||||
assert.equal(contents, 'Hello Zotero\n');
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue