From 5adb1444d8b3177e8f3be2897960215177cbadf9 Mon Sep 17 00:00:00 2001 From: xiangyu <3170102889@zju.edu.cn> Date: Fri, 16 Dec 2022 19:50:47 +0800 Subject: [PATCH] fix: read prefs content via http bug --- src/utils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index e7304c0..68ed31b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -108,12 +108,19 @@ class AddonUtils extends AddonModule { this.Tool.log("registerPrefPane:detected", options); const Zotero = this.Compat.getZotero(); options.id || (options.id = `plugin-${new Date().getTime()}`); + const contenrOrXHR = await Zotero.File.getContentsAsync( + options.src + ); + const content = + typeof contenrOrXHR === "string" + ? contenrOrXHR + : (contenrOrXHR as any as XMLHttpRequest).response; const src = ` - ${(await Zotero.File.getContentsAsync(options.src)) as string} + ${content} `; const frag = this.Compat.parseXHTMLToFragment( src,