diff options
author | Bharat Mediratta <bharat@menalto.com> | 2013-01-21 00:51:31 -0500 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2013-01-21 00:52:52 -0500 |
commit | 8dc34dade882768feb8100d7041d94c7d446b818 (patch) | |
tree | d15e9450e07717225b55e4f23157725ddb8eed35 /modules/gallery/helpers/data_rest.php | |
parent | f1d2a8e871327d250574d2dd7cacbb21ea3ae995 (diff) |
Add unit tests for data_rest. While I'm in there, get rid of the
clause that returns nothing when the album has no album cover - we'll
fail before that if the album's thumbnail is missing, and if it's not
missing then we'll have something to serve even if it's out of date.
Diffstat (limited to 'modules/gallery/helpers/data_rest.php')
-rw-r--r-- | modules/gallery/helpers/data_rest.php | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/modules/gallery/helpers/data_rest.php b/modules/gallery/helpers/data_rest.php index ef4f17e7..ad369037 100644 --- a/modules/gallery/helpers/data_rest.php +++ b/modules/gallery/helpers/data_rest.php @@ -51,12 +51,6 @@ class data_rest_Core { // We don't need to save the session for this request Session::instance()->abort_save(); - if ($item->is_album() && !$item->album_cover_item_id) { - // No thumbnail. Return nothing. - // @todo: what should we do here? - return; - } - // Dump out the image. If the item is a movie or album, then its thumbnail will be a JPG. if (($item->is_movie() || $item->is_album()) && $p->size == "thumb") { header("Content-Type: image/jpeg"); @@ -68,7 +62,11 @@ class data_rest_Core { if (isset($p->encoding) && $p->encoding == "base64") { print base64_encode(file_get_contents($file)); } else { - readfile($file); + if (TEST_MODE) { + return $file; + } else { + readfile($file); + } } // We must exit here to keep the regular REST framework reply code from adding more bytes on |