jacktuck / unfurl

Metadata scraper with support for oEmbed, Twitter Cards and Open Graph Protocol for Node.js :zap:
MIT License
481 stars 52 forks source link

Unfurling image URLs broken in 1.1.7+ #41

Closed brenc closed 5 years ago

brenc commented 5 years ago

Unfurling https://pbs.twimg.com/media/DHOfU6fVYAItcBY.jpg in 1.1.6 returns:

{ other: { _type: 'image' } }

In 1.1.7:

error unfurling URL: Error: content-type must be text/html
    at fetch.then.res (/home/bcolby/dev/unfurl-test/node_modules/unfurl.js/index.js:70:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

This breaks my app of course. I wouldn't expect this from a minor version change. I've had to revert back to 1.1.6 for now.

Looks like 3 changes even more:

error unfurling URL: { Error
    at new UnexpectedError (/home/bcolby/dev/unfurl-test/node_modules/unfurl.js/src/unexpectedError.ts:21:18)
    at /home/bcolby/dev/unfurl-test/node_modules/unfurl.js/src/index.ts:59:11
    at Generator.next (<anonymous>)
    at fulfilled (/home/bcolby/dev/unfurl-test/node_modules/unfurl.js/dist/index.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
  name: 'WRONG_CONTENT_TYPE',
  info: { contentType: 'image/jpeg', contentLength: '169418' } }
jacktuck commented 5 years ago

Why does this break your app?

In both cases unfurling an image throws an error? Were you rely on the name of the error? You're right it should have probably been a major or minor release, I'll be more diligent for future releases :)

brenc commented 5 years ago

Why does this break your app?

Because 1.1.6 outputs JSON and 1.1.7 throws an error.

Anyway, I'll close the issue since you already have a new version out. I just thought I'd bring this to your attention so it hopefully doesn't happen again between minor versions.