broidHQ / integrations

Connect your App to Multiple Messaging Channels with the W3C Open standard.
https://www.broid.ai
GNU Affero General Public License v3.0
746 stars 83 forks source link

broid-slack shows Error: mediaType.startsWith is not a function when reply message which type is Image #116

Closed ShinyChang closed 7 years ago

ShinyChang commented 7 years ago

Overview

platform: broid-slack

Steps to Reproduce

  1. Start application with settings
  2. Send message
  3. Reply message with Image which url is https://goo.gl/OD829u.qr

Observed

TypeError: mediaType.startsWith is not a function
    at Parser.parse (/Users/shinychang/bots/node_modules/broid-slack/lib/core/parser.js:53:27)
    at MergeMapSubscriber.Rx_1.Observable.merge.mergeMap.mergeMap [as project] (/Users/shinychang/bots/node_modules/broid-slack/lib/core/adapter.js:184:51)
    at MergeMapSubscriber._tryNext (/Users/shinychang/bots/node_modules/rxjs/operator/mergeMap.js:120:27)
    at MergeMapSubscriber._next (/Users/shinychang/bots/node_modules/rxjs/operator/mergeMap.js:110:18)
    at MergeMapSubscriber.Subscriber.next (/Users/shinychang/bots/node_modules/rxjs/Subscriber.js:89:18)
    at MergeMapSubscriber.notifyNext (/Users/shinychang/bots/node_modules/rxjs/operator/mergeMap.js:143:30)
    at InnerSubscriber._next (/Users/shinychang/bots/node_modules/rxjs/InnerSubscriber.js:23:21)
    at InnerSubscriber.Subscriber.next (/Users/shinychang/bots/node_modules/rxjs/Subscriber.js:89:18)
    at /Users/shinychang/bots/node_modules/rxjs/util/subscribeToResult.js:36:29
    at tryCatcher (/Users/shinychang/bots/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/shinychang/bots/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/shinychang/bots/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/shinychang/bots/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/shinychang/bots/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/Users/shinychang/bots/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/shinychang/bots/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/shinychang/bots/node_modules/bluebird/js/release/async.js:17:14)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

Expected

Should not throw error in https://github.com/broidHQ/integrations/blob/master/broid-slack/src/core/parser.ts#L67

killix commented 7 years ago

Thanks for the report. It will fix with the next release (track #81). Look like mimetype librairie doesn't get the mime type of your url.

killix commented 7 years ago

fixed with the version 2.2.0