wechaty / puppet-padlocal

Puppet PadLocal is a Pad Protocol for WeChat
https://wechaty.js.org/docs/puppet-providers/padlocal
Apache License 2.0
642 stars 88 forks source link

不支持发送svg格式的图片 #83

Closed chengduwuyong closed 2 years ago

chengduwuyong commented 3 years ago

使用 ding-dong 机器人进行测试,发现padlocal协议发送.svg格式图片时,报"Unsupported MIME type: application/xml"

发送代码为: const fileBox = FileBox.fromUrl('https://wechaty.js.org/img/friday-qrcode.svg') await msg.say(fileBox)

使用默认协议:wechaty-puppet-wechat,可以发送成功

详细堆栈如下: REPLY: dong (node:4076) UnhandledPromiseRejectionWarning: Error: Unsupported MIME type: application/xml at Jimp.throwError (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/nodemodules/@jimp_utils@0.16.1@@jimp/utils/dist/index.js:33:13) at Jimp.parseBitmap (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/nodemodules/@jimp_core@0.16.1@@jimp/core/dist/utils/image-bitmap.js:198:32) at Jimp.parseBitmap (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/nodemodules/@jimp_core@0.16.1@@jimp/core/dist/index.js:431:32) at new Jimp (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/nodemodules/@jimp_core@0.16.1@@jimp/core/dist/index.js:384:13) at _construct (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/nodemodules/@babel_runtime@7.14.6@@babel/runtime/helpers/construct.js:22:21) at /Volumes/workspace/nodjsworkspace/wechaty-getting-started/nodemodules/@jimp_core@0.16.1@@jimp/core/dist/index.js:926:32 at new Promise () at Function.Jimp.read (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/nodemodules/@jimp_core@0.16.1@@jimp/core/dist/index.js:925:10) at Object. (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/MediaUtils.js:16:34) at Generator.next () at /Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/MediaUtils.js:8:71 at new Promise () at awaiter (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/MediaUtils.js:4:12) at Object.getImageSize (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/MediaUtils.js:14:12) at /Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/FileUtils.js:88:46 at Generator.next () at /Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/FileUtils.js:8:71 at new Promise () at awaiter (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/FileUtils.js:4:12) at generateUploadImageMeta (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/FileUtils.js:83:12) at Object. (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/FileUtils.js:123:39) at Generator.next () at /Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/FileUtils.js:8:71 at new Promise () at awaiter (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/FileUtils.js:4:12) at Object.prepareImageUpload (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/utils/FileUtils.js:122:12) at PadLocalClientApi. (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/PadLocalClientApi.js:124:51) at Generator.next () at /Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/PadLocalClientApi.js:27:71 at new Promise () at awaiter (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/PadLocalClientApi.js:23:12) at PadLocalClientApi.sendImageMessage (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_padlocal-client-ts@0.4.0@padlocal-client-ts/dist/PadLocalClientApi.js:120:16) at PuppetPadlocal.messageSendFile (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_wechaty-puppet-padlocal@0.4.1@wechaty-puppet-padlocal/dist/puppet-padlocal.js:614:53) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async WechatifiedMessage.say (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/node_modules/_wechaty@0.61.20@wechaty/dist/src/user/message.js:439:21) at async Wechaty.onMessage (/Volumes/workspace/nodjsworkspace/wechaty-getting-started/examples/bot1.js:66:7) (Use node --trace-warnings ... to show where the warning was created) (node:4076) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:4076) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

padlocal commented 2 years ago

Sorry, padlocal doesn't support sending svg images. You can convert to jpeg or png before sending.