Mephisto Flickr Update

Thank’s to Nathaniel Brown for pointing this out.

A few days ago Flickr seemed to change their URL scheme for images served inside their RSS feed. The Mephisto plugin I wrote included the Flickr aggregation library from Typo. This does some regular expression parsing to determine the URL for other image sizes, but, because Flickr had changed their URL scheme, it broke.

Fortunately, the fix is pretty straightforward. Of course, first the test to show the new behaviour of Flickr:

def test_should_generate_correct_address_for_each_image_size  pic =    :title => 'test',    :description => ''  )  assert_equal '', pic.image  assert_equal '', pic.medium

Running the test shows that we get an error - the regular expression fails to pick up the URL correctly:

NoMethodError: You have a nil object when you didn’t expect it!You might have expected an instance of Array.The error occurred while evaluating nil.first

So, we change our aggregation library to fix it as:

def image  description.scan( /(http:\/\/.*(static|photos).*?\.jpg)/ ).first.firstend

Run the test again and we’re green.

I’ve committed the changes into the Subversion repository. So feel free to get the update!

Incidentally, I wonder whether this is related to Ezra Zygmuntowicz’s post about speeding up page loads by serving images from cnames. Maybe it’s just coincidence.