Help updating an Add-On for Zotero 6

Hi there. I maintain http://mackerron.com/zot2bib/.

It's not working in Zotero 6 (even after bumping the max Zotero version in install.rdf).

The add-on relies on running an AppleScript, and it seems unable to extract script from its bundle in order to run it.

This is the code that attempts to do this:

async function extractResource(resource) {
return new Promise(function (resolve) {
AddonManager.getAddonByID("zot2bib@mackerron.com", async function (addon) {
const scriptURI = addon.getResourceURI(resource);
const url = scriptURI.spec;

const tmpDir = OS.Path.join(Zotero.getTempDirectory().path, 'Zot2Bib')
await OS.File.makeDir(tmpDir);

const filename = url.match(/\/([^\/]+)$/)[1];
const path = OS.Path.join(tmpDir, filename);

await Zotero.File.download(url, path);

resolve(path);
});
});
}

var zoteroCallback = {
notify: async function(event, type, ids, extraData) {
if (event == 'add') {
var items = Zotero.Items.get(ids);
var script_path = await extractResource('zot2bib.applescript');
// Zotero.log('AppleScript: ' + script_path);
/* ... */
}
/* ... */
}

And these are the errors I get:

[JavaScript Error: "Error: Download failed with response code null" {file: "chrome://zotero/content/xpcom/file.js" line: 494}]

Any ideas?

The complete code is at https://github.com/jawj/Zot2Bib.

Thanks,
George
This discussion has been closed.