PicGo/PicGo-Core

请教一下,写了一个 Uploader,使用时报出错误

MYXXTS opened this issue · 3 comments

请教一下,写了一个 Uploader,上传图片的时候时报出错误

使用 picgo 2.3.1

以下为PicGo的错误日志
2023-01-10 08:51:27 [PicGo INFO] Before transform 2023-01-10 08:51:27 [PicGo INFO] Transforming... Current transformer is [path] 2023-01-10 08:51:27 [PicGo INFO] Before upload 2023-01-10 08:51:27 [PicGo INFO] beforeUploadPlugins: renameFn running 2023-01-10 08:51:27 [PicGo INFO] Uploading... Current uploader is [cheveretov4] 2023-01-10 08:51:27 [PicGo WARN] failed 2023-01-10 08:51:27 [PicGo ERROR] ------Error Stack Begin------ TypeError: Cannot use 'in' operator to search for 'value' in null at mt (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:47504) at C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:49862 at Ut.request (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:50075) at Object.handle (C:\Users\Administrator\AppData\Roaming\picgo\node_modules\picgo-plugin-cheveretov4\src\index.js:29:38) at $e.doUpload (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:17221) at $e.start (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:15980) at async Tt.upload (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:71270) at async Object.upload (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\background.js:2:653584) at async jn (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\background.js:2:656251) -------Error Stack End------- 2023-01-10 08:51:27 [PicGo ERROR] ------Error Stack Begin------ TypeError: Cannot use 'in' operator to search for 'value' in null at mt (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:47504) at C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:49862 at Ut.request (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:50075) at Object.handle (C:\Users\Administrator\AppData\Roaming\picgo\node_modules\picgo-plugin-cheveretov4\src\index.js:29:38) at $e.doUpload (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:17221) at $e.start (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:15980) at async Tt.upload (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\index.cjs.js:1:71270) at async Object.upload (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\background.js:2:653584) at async jn (C:\Users\Administrator\AppData\Local\Programs\PicGo\resources\app.asar\background.js:2:656251) -------Error Stack End-------

相关代码:
image

烦请解答一下谢谢

报错在这一行

https://github.com/PicGo/PicGo-Core/blob/dev/src/lib/Request.ts#L18

检查一下你的 formData 会不会出现 null 的情况。

'value' in null 就会报日志里的错

好的谢谢