Closed Bug 961443 Opened 10 years ago Closed 10 years ago

Popcorn Maker crashes when doing a Flickr search for "altamont"

Categories

(Webmaker Graveyard :: Popcorn Maker, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jon, Assigned: mjschranz)

Details

Attachments

(2 files)

If you do a search for "altamont" you'll crash the Flickr search with the following stack trace:

TypeError: Cannot read property 'source' of undefined
    at Request._callback (/Users/jon/Sites/popcorn.webmaker.org/node_modules/webmaker-mediasync/lib/services/flickr.js:70:31)
    at Request.self.callback (/Users/jon/Sites/popcorn.webmaker.org/node_modules/webmaker-mediasync/node_modules/request/index.js:148:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/Users/jon/Sites/popcorn.webmaker.org/node_modules/webmaker-mediasync/node_modules/request/index.js:876:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/Users/jon/Sites/popcorn.webmaker.org/node_modules/webmaker-mediasync/node_modules/request/index.js:827:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

It appears to crash on an API response that looks like this:

{ sizes:
   { canblog: 0,
     canprint: 0,
     candownload: 0,
     size:
      [ { label: 'Square',
          width: 75,
          height: 75,
          source: 'https://farm4.staticflickr.com/3715/11834955185_c17ef3b0f8_s.jpg',
          url: 'http://www.flickr.com/photos/drwbe/11834955185/sizes/sq/',
          media: 'photo' },
        { label: 'Large Square',
          width: '150',
          height: '150',
          source: 'https://farm4.staticflickr.com/3715/11834955185_c17ef3b0f8_q.jpg',
          url: 'http://www.flickr.com/photos/drwbe/11834955185/sizes/q/',
          media: 'photo' },
        { label: 'Thumbnail',
          width: '100',
          height: '37',
          source: 'https://farm4.staticflickr.com/3715/11834955185_c17ef3b0f8_t.jpg',
          url: 'http://www.flickr.com/photos/drwbe/11834955185/sizes/t/',
          media: 'photo' },
        { label: 'Small',
          width: '210',
          height: '78',
          source: 'https://farm4.staticflickr.com/3715/11834955185_c17ef3b0f8_m.jpg',
          url: 'http://www.flickr.com/photos/drwbe/11834955185/sizes/s/',
          media: 'photo' } ] },
  stat: 'ok' }
Assignee: nobody → schranz.m
Status: NEW → ASSIGNED
Basically the photo it was trying to process had none of the expected sizes we considered valid. I decided to add a few more for leniency and added code to bail early if we still couldn't get something for the "source image".
Attachment #8362170 - Flags: review?(jon)
Further safeguards against potential null objects returned in data sets.
Attachment #8362172 - Flags: review?(jon)
Attachment #8362172 - Flags: review?(jon) → review+
Attachment #8362170 - Flags: review?(jon) → review+
Commit pushed to master at https://github.com/mozilla/popcorn.webmaker.org

https://github.com/mozilla/popcorn.webmaker.org/commit/85db599a3ff29f8e23c05c7638170b31383cbe17
Bug 961443 - Add some safeguards from null objects returned in the dataset for Media Search queries
Fixed with above commit and https://github.com/mozilla/webmaker-mediasync/commit/ce25192031862e571e376f14234d352d45caaab7
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: