let の罠にはまってしまった!(Ank Pixiv Tool 更新)

なまえ 2009/03/25 20:21
Ank Pixiv Tool 1.3.0に更新したところ、「ankpixiv.sqlite」内の「histories」の「local_path」・「filename」の二か所の値がundefinedと記録されるようになっていました。こちらがおかしな操作をしてしまったのかもしれませんが、お知らせしておきます。

上に引用した報告のバグを修正した。
https://addons.mozilla.org/en-US/firefox/addon/7614

バグの原因

var を let に置き換えたときの影響で、let の罠にはまってしまった様子。

diff --git a/source/chrome/content/ankpixiv.js b/source/chrome/content/ankpixiv.js
index dd045ff..da3173e 100644 (file)
--- a/source/chrome/content/ankpixiv.js
+++ b/source/chrome/content/ankpixiv.js
@@ -575,7 +575,7 @@ try {
         let onComplete = function (orig_args, local_path) {
           let caption = this.Locale('finishedDownload');
           let text = filenames[0];
-          let local_path = decodeURIComponent(local_path);
+          local_path = decodeURIComponent(local_path);
 
           if (this.Prefs.get('saveHistory', true)) {
             try {