Fix undefined variable in cache

A function to verify metadata in the cache middleware was falling over
for GETs on images with a missing size.

Fixes bug 1183049

Change-Id: I2da75e5e5aca12d20a10cace2a3779e4041161b2
Merge "Fix undefined variable in cache"